the loading of images is a function of your browser after the page has been
sent by the server to it.
The only way I can think of doing this (barring some funky Java class
like ReturnImagesFromContextInterceptor.class, which I'm not sure how
you'd do?) is to prefix all your /images/ references with the name of the
current context, so instead of /images/myimage.gif, you would do
/myWebApp/images/myimage.gif
If you didn't want to hardcode these to your context, you could put the
context in dynamically based on a variable in your servlet or, before
sending the stream back, look for any /images/ references and to a replace
with the correct path. Not sure how to do that, offhand, but I'm quite
sure it can be done.
Jake
>Hi, I need some advice on how I might fix a problem with one of our web
apps. We farmed out an app that works ok except that the web pages which
are >created by servlets are looking for images in the tomcat root images
directory. This presents a problem in that if I create a war of our app I
also have to >distribute and copy the images over to the root images
directory. Can I set up my web.xml file so that when a web page looks for
an image in the /images >directory it actually pulls them out of my
myWebApp/images directory. What I am trying to achieve is one war file that
I can use to distribute our app without >having the customer copy images
over to the root/images directory. Thanks for any help. Regards Alex Colic-0132