• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Displaying an image in jsp

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
 
Ashish Saraf
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 think I'll just lie down here for a second. And ponder this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic