Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populate many images from a Blob to a .JSP

 
André Asantos
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How could I do to print on JSP page some images from a Blob, those images were in a byte format and now are in an InputStream format, as I've said
are more than only one picture/image so I put all on an array and now I have a big problem to show on JSP cause only one is shown and I don't know why that
works this way... Look at below to understand completly my big and old problem that does I can't finish my first difficult use case as Junior Java...



struts.xml (Struts2)



Método q pega os registros da base de dados e adiciona no array
Classe responsável pelo Upload das imagens:

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSPs are just templates to create HTML pages. As such, images are displayed in a JSP just like in an HTML page. And, in an HTML page, do you embed the binary image data? Of course not. You use <img> tags. Same in a JSP.

So your array of binary image data is useless. What you need to do is to create <img> tags that reference a servlet that will serve each image individually.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic