File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Populate many images from a Blob to a .JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Populate many images from a Blob to a .JSP" Watch "Populate many images from a Blob to a .JSP" New topic

Populate many images from a Blob to a .JSP

André Asantos
Ranch Hand

Joined: Nov 23, 2009
Posts: 234
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

Joined: Jan 10, 2002
Posts: 63858

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.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Populate many images from a Blob to a .JSP
It's not a secret anymore!