my dog learned polymorphism
The moose likes Servlets and the fly likes How to display an image file to jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "How to display an image file to jsp" Watch "How to display an image file to jsp" New topic
Author

How to display an image file to jsp

John McDonald
Ranch Hand

Joined: Jul 01, 2003
Posts: 112
Hi there,
In the server code, if I have an image file on the memory, how do I write it in to a jsp file to display? I don't want to disposite to a physical location and then use image tag <img src=".../picture.jpg">. Thanks.

John Giang
[ December 19, 2005: Message edited by: Ben Souther ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56547
    
  14

The src of the image tag can reference a servlet that can serve up the image data. Be sure to set the response headers correctly.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you'd like an example, I have one on my site.
http://simple.souther.us
Look for SimpleStream.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to display an image file to jsp
 
Similar Threads
handling image in jsp
Display image in JSP
read and display an Image
thumbnail in jsp
Displaying image from file server