struts - how to display image from database ?

Discussion in 'Java' started by Maciej, Apr 26, 2005.

  1. Maciej

    Maciej Guest

    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
    Maciej, Apr 26, 2005
    #1
    1. Advertising

  2. Maciej

    Guest

    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.
    , Apr 26, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sandi
    Replies:
    3
    Views:
    1,749
    Natty Gur
    Nov 6, 2003
  2. Olav Tollefsen

    How to display image blob from database?

    Olav Tollefsen, Apr 25, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,373
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Apr 25, 2004
  3. =?Utf-8?B?U1M=?=
    Replies:
    3
    Views:
    3,813
    Juan T. Llibre
    May 15, 2005
  4. Replies:
    1
    Views:
    1,252
    Metalore
    Oct 18, 2006
  5. Replies:
    1
    Views:
    216
Loading...

Share This Page