Another problem with images

Hi all, I'm new here

I need to retrieve images list from database and to show them on JSP. Images are saved in MySQL database as BLOB.

Any idea how to do this? I searched for similar topic here, but couldnt find anything...

Any tips&tricks are more than welcome - thanks in advance.

[312 byte] By [djordjewa] at [2007-10-3 2:51:02]
# 1

make a servlet which:

- sets the response's content type to your image MIME type (response.setContentType()), use "image" if you want browser functionality like "set as desktop background"

- streams your Blob's inputStream to the client

to get you input stream:

Blob blob = rs.getBlob("the_blob");

InputStream input = blob.getBinaryStream();

byte[] bytes = new byte[input.available()]; // Use any buffer size you want

Message was edited by:

JF_Beaulac

JF_Beaulaca at 2007-7-14 20:39:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...