Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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 The Software Craftsman this week in the Agile 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: 9327

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.
I agree. Here's the link:
subject: Path to JavaScript or CSS