Sundhas
Sundhas

Reputation: 605

How to Attach styleSheet.css in tomcat (Servlet)

I have made a webpage in Servlet and now i want to add a stylesheet.css to it Where should i exactly put the .css file ? like in ROOT of tomcat or some where else and what exact path i have to use??

link href='style.css' rel='stylesheet' type='text/css'

Thanks Sundhas

Upvotes: 1

Views: 8217

Answers (4)

Rajkumar Singh
Rajkumar Singh

Reputation: 11

Put your css into the webcontent folder. In the href provide an absolute link to the css and for html formatting use out.prinln statement.

Upvotes: 1

Sundhas
Sundhas

Reputation: 605

Thanks EveryOne! I figured this out

Well actually you don't have to paste the FILE.CSS in Root of tomcat you actually have to paste the .css file where your netbeans Projects reside for example C://Documents and settings/NetbeansProject/ProjectName/Web Paste the .Css over there

and so this remains same : link href='style.css' rel='stylesheet' type='text/css'

~Sundhas~

Upvotes: 1

BalusC
BalusC

Reputation: 1109302

Put the file somewhere in WebContent. There where your JSP files also are. Or did you abuse the Servlet to generate the HTML output? Well, at least, the public files needs to be placed in the WebContent folder. The folder name might differ from environment to environment, but it is at least the very same root folder where the WEB-INF folder resides. You normally place public content there.

Upvotes: 1

Dominik
Dominik

Reputation: 1252

Since you are using a relative path, it should be in the same location as your jsp. If you write your HTML in the Servlet, it should be placed in the root of the webapp.

Upvotes: 0

Related Questions