File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes How to define file paths in Tomcat 3.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to define file paths in Tomcat 3.1" Watch "How to define file paths in Tomcat 3.1" New topic

How to define file paths in Tomcat 3.1

Travis Gibson
Ranch Hand

Joined: Oct 17, 2000
Posts: 100
Howdy fellow ranchers,
The question I have relates to including GIFs inside of JSPs. When I am testing the JSPs using localhost:8080 the GIFs are found and displayed just fine.
But when I attempt to use my JSPs from outside my localhost the JSPs still work but the GIFs are missing.
I setup an image directory in directory which contains the JSP. and used "/image/test.gif" but JSPs still cannot locate the gif.
It displays the gifs just fine if I define the entire path (i.e. C:\jsp\images\test.gif) but I don't like the idea of having hardcoded paths in my JSP code

Any suggestions..??

Travis M. Gibson, SCJP
Java Developer

Regards,<BR>Travis M. Gibson, SCJP<BR>Java Developer<BR><BR>
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

generally I have seen that the images can be displayed when
you use image/test.gif. I don't think you should use /image/test.gif. However, you shouldn't put them under WEB-INF
So the dir structure would be:

My two cents.
- satya

Take a Minute, Donate an Hour, Change a Life
I agree. Here's the link:
subject: How to define file paths in Tomcat 3.1
It's not a secret anymore!