This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 12760
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
Similar Threads
java.awt.Image to a HTML file via a servlet
servlet applet communication.
calling servlet from another servlet and reading response
dimension not perfect