wood burning stoves*
The moose likes JSP and the fly likes problem with webapp directory structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "problem with webapp directory structure" Watch "problem with webapp directory structure" New topic

problem with webapp directory structure

Bruce Riches

Joined: Apr 24, 2006
Posts: 14
I'm running TC 6.0.13 and have deployed a webapp to a std directory structure ie;

In my JSP I have a tag like <SCRIPT type="text/javascript" src="js/runner.js" ></SCRIPT>
Similarly I have a another tag like <link rel="stylesheet" type="text/css" href="css/styles.css">

In both cases the external script file and the style sheet are not found. Of course if I make these things 'inline' there's no problem. I have tried referencing these files like WEB-INF/js/runner.js, /WEB-INF/js/runner.js, /js/runner.js and the files are still not found.
Any ideas appreciated...
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60782

The server will not directly serve anything that under WEB-INF, so you can't put anything that's directly addressed there. This means that stylesheets, script file and images should not be placed under WEB-INF.

Since this is not anything that's Tomcat specific, it's been moved to a more general forum.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60782

You will also find that you encounter fewer problems if you ditch the page-relative addressing in favor of server-relative addressing.
I agree. Here's the link: http://aspose.com/file-tools
subject: problem with webapp directory structure
Similar Threads
Struts help
what is the URL ?
problem in running external java Script
JSF, Facelets and paths inside javascript file
absolute & relative file addressing in Tiles