struts - how to display image from database ?

M

Maciej

hello,

I have a problem in displaying image in jsp from database.
i use Hibernate to retrive data from db, after that I pass list of objects to jsp.

One object contains some string fields and one byte[] field with uploaded picture.
to display object's string fields in jsp i use for example
<bean:write name="obiekt" property="powUzytkowa" />

How to display image, which is stored in object's field as byte[] ?

best regards,
Maciej
 
G

gimme_this_gimme_that

You need to create a separate servlet having it's own url.
It must assign the MIME type and write the binary code.

Your code doesn't work because the image will be displayed
with a text/html MIME type.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top