aspose file tools*
The moose likes Servlets and the fly likes images in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "images in servlet" Watch "images in servlet" New topic

images in servlet

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I am new to java servlet. I need an image in a servlet (running Tomcat). It seems to me I have to specify the absolute path for the image before it can be displayed. I tried to put the image under the same directory of the servlet, and it did not work. If I have to put the image under the images directory, how can I use a virtual path?
Mahajan Bhupendra
Ranch Hand

Joined: Dec 01, 2000
Posts: 118
specify the complete path of image i.e c:\....
or specify the complete virtual path
i.e. http://localhost:8080/...
usually class files are kept in one folder ..
i don't no which is in terms of tomcat...
store image file on virtual path
and see if image is coming in ur browser..

<B>Bhupendra Mahajan</B>
I agree. Here's the link:
subject: images in servlet
Similar Threads
putting image files to Jar File in Swing application
Accessing images from another path in UNIX
JSP not getting rendered
How to know the absolute directory path of WebContent folder?
Where to store image files in Java web app