Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

root directory of a web app  RSS feed

 
Ra Carter
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it seems like there are some inconsistencies about what is the root directory of a java web app...

i have the following directory structure:
mywebapp


and then i have in a web page



that's not exactly what i am doing because I am using EL to specify the folder locations dynamically (i.e. ${initParam.imgdir}/pic.jpg) but i think it is the same..

anyway it looks like the include directive works properly but the image dir is looking a directory above the webapp dir (i.e. http://localhost/img/pic.jpg instead of http://localhost/mywebapp/img/pic.jpg)

why is it not looking for img in the root of the web app directory and can i change it so it does work?
[BSouther: Added UBB CODE tags]
[ July 08, 2007: Message edited by: Ben Souther ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not an inconstancy in the way Java works.
Your comparing client side, markup code with server side JSP code.

You image tag is just text as far as the JSP interpreter is concerned.
It just sends it to the browser, verbatim.
The JSP tags, on the other hand are interpreted on the server.
Since your browser knows nothing about server side Java apps, it has now way of knowing what your context path is unless you specify it.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!