• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File path in Tomcat

 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My image files are not displayed on my jsp pages. The container cannot read the relative path.

My app. name is : dice
My imge files are in: dice/images
my context path in server.xml is : /dice

In my jsp I have <img src="/images/home/question_mark.gif">
This .gif file cannot be displayed.
If I modify it to be <img src="/dice/images/home/question_mark.gif">
It works fine

What puzzling me this code works fine: <%@ include file="/doc/help.html" %>

Both the directive and the html code use relative paths. One works, and the other doesn't. How can I tell the container to look at the relative path of the application.

Thanks

Thanks
 
Ilari Moilanen
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand your problem correctly then both of these should work
<img src="/dice/images/home/question_mark.gif">
<img src="images/home/question_mark.gif">

the first one since it now points to the root (provided that the server is configured so that the image is located here http://domainname/dice/images/home/question_mark.gif)
and the second one since now you don't start at the root but from where you are currently located. This of course requires that the page that has the link is viewed to user at the root of "dice/".

Hope this helps.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved..

Moilanen,
Thank you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic