Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > struts - how to display image from database ?

Thread Tools

struts - how to display image from database ?

Posts: n/a

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,
Reply With Quote
Posts: n/a
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.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase Computer Information 0 09-26-2012 09:40 AM
Display Image from Database in Image Control ASP .Net 1 10-18-2006 01:48 PM
Display Image from Database in an Image control ASP .Net Web Services 1 08-25-2005 07:38 PM
HOWTO: display database without refresh web page to query database =?Utf-8?B?U1M=?= ASP .Net 3 05-15-2005 08:22 PM