my dog learned polymorphism*
The moose likes Struts and the fly likes Path to JavaScript or CSS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Path to JavaScript or CSS" Watch "Path to JavaScript or CSS" New topic

Path to JavaScript or CSS

vinoth kumar v

Joined: Sep 27, 2010
Posts: 6
How should i mention the path in my jsp page so that i can include css or js?

My Struts Structure



I used the above code but iam not getting the css applied in my jsp.

Thanks in advance

[Thumbnail for Capture.JPG]

Ankit Garg

Joined: Aug 03, 2008
Posts: 9291

The browser can't access files inside of WEB-INF directory directly. You'll have to move your CSS directory outside of the WEB-INF directory i.e. under the WebContent folder...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
vinoth kumar v

Joined: Sep 27, 2010
Posts: 6
Hi I pasted the css in the web content and i changed my code as below


but still it doesnt work. It would be great if you provide me some example.

I like to have css and javascripts in seperate folder.

so please give an example assuming that it is in some folder
and also give me good programming practices of placing the css and js files in STRUTS appliction with example


vinoth kumar v

Joined: Sep 27, 2010
Posts: 6
Iam still facing the issue.
Can anyone help me on this.
wood burning stoves
subject: Path to JavaScript or CSS
Similar Threads
How to Set Character Encodeing in JSP
including a css file to a jsp from another folder
Not JSP. Anyone know how to just use .html files
Error "HTTP Status 404 - Invalid path /products was requested"
project file structure for web application (war).