1

we have tomcat on a windows server that everyone on the devteam can access. on this machine the stylesheet/.js links work fine. i copied the war down to my local machine and installed apache on my local machine. Now i can connect to the site at localhost:8080 and the html is served and database connection works but... it does not apply any of the styles/.js .

the other strange thing is that if i browse to the site and view source (at my local machine and at shared machine). the links to the stylesheet look like

href="/project folder/static/styles sub-folder/sub-folder/style-page.css"

there is no "static" folder on either machine. Is this a jsp convention of some sort?

Bdawg
  • 11
  • 2

1 Answers1

0

The general convention is to host the "static" stuff on a dedicated web server like Apache and keep the dynamic JSPs etc on the Tomcat.

If you don't see a "static" folder on the source Tomcat server - then I suspect it's sitting under an Apache web server and the URL /static has been mapped in the Tomcat server.xml using a <Context> element.

JoseK
  • 455
  • 6
  • 13
  • we have the following in web.xml ... would i have to change this in order for it to display properly @ localhost? – Bdawg Jun 06 '11 at 16:12
  • oops here is the xml..... default /static/* – Bdawg Jun 06 '11 at 16:12
  • okay this says the /static is mapped to a *default* servlet - this suggests that this folder should exist on tomcat itself. What is the actual servletclass for the *default* servlet? Is there any Apache web server fronting this Tomcat that you're aware of? – JoseK Jun 06 '11 at 16:25
  • there is an apache service. if it is stopped the app no longer works. I don't think anyone intentionally used it though. the css and js is located under the webapps/name_of_app/styles folder. How would i tell what the default servlet? in web.xml there are several items mapped to /*? sorry for all the newbie questions. thanks for tyhe help – Bdawg Jun 06 '11 at 17:51
  • so /static/styles gets mapped to webapps/name_of_app/styles in short, or rather /static itself is pointing your webapp-context-root i.e. webapps/. Have you checked *server.xml* in Tomcat folder for any mapping named /static? This file sits outside the war and in the *conf* directory, so this could be the problem. I assume you have definitely copied all the war contents and styles onto your local machine as well and kept them in the same path. – JoseK Jun 06 '11 at 18:04