This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Linkking css & js to jsp in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Linkking css & js to jsp in struts" Watch "Linkking css & js to jsp in struts" New topic
Author

Linkking css & js to jsp in struts

kavin clain
Ranch Hand

Joined: Jan 19, 2010
Posts: 68
I am working on struts project. I want to keep my jsp pages and related css & javascript file inside WEB-INF.
But doing this I am unable to link & reference the css & js files in my jsp page. Here I am providing the code
to link & refer the extra files & the project structure tree.



It didn't work, then I tried,


again it also didn't work,

this is the folder tree
MyProject
----------WEB-INF
------------------pages
------------------------css
-----------------------------main.css
------------------------js
------------------------------common.js
------------------------register.jsp
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
WEB-INF is not publicly accessible so it is impossible to link to the external file with a link and script tag.

You have to move the files out of WEB-INF.

Eric
 
Don't get me started about those stupid light bulbs.
 
subject: Linkking css & js to jsp in struts
 
Similar Threads
what is the URL ?
prototype framework with ajax that is using struts 2 in jsp
problem with webapp directory structure
Directory Structure JSP & JS
absolute & relative file addressing in Tiles