*
The moose likes Servlets and the fly likes How to display an image file to jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
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: 61105
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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
 
 
subject: How to display an image file to jsp