• 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

Display images in a JSP page

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created an ArrayList which contains Member objects. Each Member object has an attribute called picture (Data type is byte[]).
I need to show all pictures in one JSP page and I like to use <img> tags for that.
How can I do that? Any ideas
Thanks.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, in your JSP, create images tags (one for each element in the array).
Then, create a servlet that can respond to the image request by streaming the bytes down to the client; with the correct mime and disposition headers, of course.

The closest thing I can offer you is a demo project that I wrote which streams an image to the browser using context.getResourceAsStream.

http://simple.souther.us
Look for SimpleStream
 
Chatura Dilan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Ben Thanks for your reply
 
reply
    Bookmark Topic Watch Topic
  • New Topic