File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Servlet and Image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet and Image" Watch "Servlet and Image" New topic

Servlet and Image

Amod Deshpande

Joined: Sep 04, 2003
Posts: 8
I am trying to set a background image in a servlet but it is not displaying it. I am using SunOne and TomCat and stored image in Web-Inf folder. Can anyone answer how to display the image???

Malhar Barai
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
Is it possible for you to paste your code over here, we would like to know how you are accessing the background "image", & why would you like to set an image background in a servlet..??

Malhar Barai
SOA & Java Book
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13026
I'm assuming you want an image displayed in an HTML page - note that web servers are not allowed to directly serve ANY resource under WEB-INF so you will have to either move the image file or write servlet code to serve it. Naturally the image src in the HTML will have to match.
I agree. Here's the link:
subject: Servlet and Image
It's not a secret anymore!