11

Here is my simple (I hope) problem:

I 'm running a web app with eclipse through tomcat 7. I use the classic servlet-model-jsp pattern. My problem is when I change something in the stylesheet (CSS) and restart tomcat and reload the page on the chrome, the new css is not loaded on the browser (I check it through the browser and i see the same as before the changes).

What is wrong and what can i do about it?!

Thank you in advance :)

1 Answers1

5

I don't think this is a client issue. I think it is a bug in Eclipse/ Tomcat plugin. If you check the request.getPathTranslated() inside the servelet doGet method, it will be something like

C:\Users\YourName\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\
wtpwebapps\yourAppName\

So the tomcat running inside eclipse is serving up static content from there, which is different to the location of static content that you are editing, which is usually something like

C:\fullPathTo\yourAppName\src\main\webapp\static

Tomcat inside eclipse often neglects to update the static content from where you have edited it to the plugins... spot from where it serves it to your web page.

To solve the problem I use Beyond Compare or similar, and set up a compare between the directories

C:\fullPathTo\yourAppName\src\main\webapp\static

and

...\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\yourAppName\static

If css or other static changes (such as javascript files) fail to show up in the browser, just do a quick refresh of the Beyond Compare window, this will highlight the mismatches, copy them across manually, and you are good to go. I know this is a hack but it works for me, till the eclipse guys get this sorted out.

Paulus
  • 1,385
  • 16
  • 20