Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a website project in Eclipse using servlets which is running on Tomcat. In one of the servlets I reference an external stylesheet as such:

<link rel="stylesheet" type="text/css" href="style.css" />

Where would I put this style.css for it to work? I have tried almost every folder in the project directory and in the site directory under Tomcat and it still won't work.

share|improve this question
up vote 1 down vote accepted

I found the solution. As silviud said, the style.css file should go in the root of the application, in this case: $TOMCAT_HOME/wtpwebapps/ProjectName. To get it there it should go in the WebContent folder in eclipse: $PROJECT_HOME/WebContent.

The reason I wasn't seeing the stylesheet was because I had the main servlet registered for "/" which means that when I requested /style.css, it got the servlet instead.

share|improve this answer

isn't that going to be served as from where you serve the html file ?! can you try to have the link changed to "/style.css" and see where is configured the root for your application.

for example if your application is into $TOMCAT_HOME/webapps/my_application you need to put the file into $TOMCAT_HOME/webapps/my_application/style.css.

look into the $TOMCAT_HOME/webapps/my_application/WEB-INF/web.xml on how is configured the servlet for your application.


ps: my example is kind of bad because java uses different 'standards' to serve static files.

share|improve this answer
I don't have an html file, I am using a servlet. It looks like it needs to go in $TOMCAT_HOME/wtpwebapps/ProjectName, but the problem is where do I put it in eclipse to make it go there? – DanielGibbs Dec 20 '10 at 21:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.