Google Answers Logo
View Question
 
Q: java servlet mapping for images ( No Answer,   1 Comment )
Question  
Subject: java servlet mapping for images
Category: Computers > Programming
Asked by: joshy688-ga
List Price: $20.00
Posted: 17 Jan 2003 13:53 PST
Expires: 16 Feb 2003 13:53 PST
Question ID: 144888
I am working on a j2ee web application.
I want the url 
   http://server.com/
to go to my servlet called "Stuff".
I want the url 
   http://server.com/images/foo.gif 
to show the gif stored in the images directory in the root directory
of
the servlet. ie, I want all images (and other resources like .css and
.js
files) to be loaded by the default servlet built into the servlet
container, but I want the / url to be sent to my servlet.  What is the
configuration I can set in my web.xml file to get this to happen.  The
solution must be j2ee app server agnostic.

I can set it to map  /stuff to Stuff and then the images will load,
but if
I map / to Stuff then everything else above / (like /images/foo.gif)
get mapped to the Stuff servlet, so then the images don't load.

How can I get the images to load when I set the Stuff servlet to be at
/?

Thanks,
- Joshua
Answer  
There is no answer at this time.

Comments  
Subject: Re: java servlet mapping for images
From: skorba-ga on 19 Jan 2003 19:39 PST
 
Dear Joshua -

I'll add this as a comment, since it is not exactly what you asked
for, but I believe it will solve your problem:

1) Create a jsp-file (Java server pages) named index.jsp.
2) Embed your servlet inside index.jsp
3) Tell your server to hand out index.jsp as the default document.
4) Configure the other options as usual.

Good luck!

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy