Multiple servlets ... one file

J

julzmagoo

Hopefully this isn't too much of a newbie question. I have been unable
to find any information about this, so I apologize if it's a repeat.

I'm working on a project where I want more than one servlet to access
the same file (image file) so I don't have to include it in every
project. Is there a way to do this? Maybe using Tomcat's shared
folder?

Thanks!
Jules
 
W

Wendy S

Hopefully this isn't too much of a newbie question. I have been unable
to find any information about this, so I apologize if it's a repeat.
I'm working on a project where I want more than one servlet to access
the same file (image file) so I don't have to include it in every
project. Is there a way to do this? Maybe using Tomcat's shared
folder?

Are you just trying to put a company logo .gif file somewhere it can be
displayed on any web page, or are you really doing something to the image in
the Servlet code?
 
W

Wendy S

Jules said:
Yes, I'm just displaying the image.

I keep images that get used from multiple contexts in ROOT/images. Then I
can display them from anywhere with an img tag like: <img
src="/images/abc.gif"/>

(On the production server, the images are in /images under Apache's document
root, so Tomcat does not have to get involved.)

This doesn't have anything to do with your Servlet(s). Images are
requested by the browser separately as the HTML is rendered, so the images
need to be somewhere visible to a client browser.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top