Dear Hubert and David, thanks for your help. Finaly i did like this :
in my jsp a create a image tag as : <img src="loadImage.do?id=<%=Integer.toString(image.getId())%>" >
loadImage.do create first a Java Temporary File (File.createTempFile) containing the bytes of the image comming from the DB. Then it generates a "document" with the appropriate content type (that i stored before) and i push the image bytes[] to the response like this :
response.setContentType("image/pjpeg");
response.setHeader("Content-Disposition", "filename="+img.getName());
response.setHeader("Cache-Control", "no-cache");
response.setContentLength((int)img.length());OutputStream ou = response.getOutputStream(); FileInputStream in = new FileInputStream(img); byte[] buffer = new byte[(int)img.length()]; in.read(buffer); ou.write(buffer); ou.flush(); ou.close(); in.close(); img.delete(); img.deleteOnExit();
Regards, Marc
David Friedman wrote:
Marc,
That's a tricky one I've planned for but haven't started yet. My research showed the html:img tag should be used with a path. That path can invoke an action (direct, not tiled) that sets the content-type to the right type of image then tosses out the binary stream. So, it should be something like this:
html:write get a URL such as "/images.do?id=555" or "http://somehost/images.do?id=555". Then your map an action for "/images" to set the content type, open the database, and print the binary stream appropriately. Sounds a bit list an advertising program, almost. :)
If something else works for you, please let me know as this is type of image display is on my to-do list.
Regards,
David
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

