Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

problem with webapp directory structure  RSS feed

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm running TC 6.0.13 and have deployed a webapp to a std directory structure ie;
/contextroot/WEB-INF/classes
WEB-INF/lib
WEB-INF/pages
WEB-INF/css
WEB-INF/js
/index.jsp

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...
 
Author and ninkuma
Marshal
Posts: 66806
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66806
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will also find that you encounter fewer problems if you ditch the page-relative addressing in favor of server-relative addressing.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!