Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display images in a JSP page

 
Chatura Dilan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • 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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Hi!
Ben Thanks for your reply
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic