aspose file tools
The moose likes Servlets and the fly likes Displaying an image in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Displaying an image in jsp" Watch "Displaying an image in jsp" New topic
Author

Displaying an image in jsp

Ashish Saraf
Greenhorn

Joined: Sep 08, 2001
Posts: 14
I am trying to display an image in the jsp.
my image is stored in db2 database and i retrieve it using an entity bean in the form of byte[];

e.g getImage() property returns byte[] containg the data of the image.
Now my problem is what code should be written in jsp to display the image in the browser.
regards
Ashish Saraf
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12271
    
    1
Remember that a JSP just builds an HTML page - to put an image in a HTML page you use the <img tag, right? Therefore your JSP must build an img tag with a HREF= with a URL to something that will serve your image as a separate operation - typically a servlet.
Most servlet/JSP books contain an example, I know mine does.
Bill
------------------
author of:


Java Resources at www.wbrogden.com
Ashish Saraf
Greenhorn

Joined: Sep 08, 2001
Posts: 14
could you send me some sample code
Originally posted by William Brogden:
Remember that a JSP just builds an HTML page - to put an image in a HTML page you use the <img tag, right? Therefore your JSP must build an img tag with a HREF= with a URL to something that will serve your image as a separate operation - typically a servlet.
Most servlet/JSP books contain an example, I know mine does.
Bill

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Displaying an image in jsp
 
Similar Threads
Ho to display image getting from byte array in JSP ?
DIsplaying Image on JSP
Display an image on JSP from byte[]
thumbnail in jsp
how to convert byte[] to blob