At the risk of getting murdered again for too many comments I'll offer this recipe
J. How to read an image from a db and display in an html page Goal: Display an image that is stored in a database blob in a .jsp page Synopsis: The blob is read into a byte array that is stored in the ActionForm. The .jsp page uses a <img tag to call an action that writes the byte array to the response. Reference: http://struts.apache.org/userGuide/struts-html.html#img The code: This reads the image in from the db // rs is the ResultSet that is returned from the db query try { pictureStream = rs.getBinaryStream("picture"); byte[] bytes = new byte[1024*1024]; // some maximum size int byteSize = pictureStream.read(bytes); // read in the bytes byte[] bytesX = new byte[byteSize]; // create a new array of the proper size for(int i=0;i<byteSize;i++) // copy them into the new array { bytesX[i] = bytes[i]; } pictureBytes = bytesX; // assign it to the form variable } catch(FileNotFoundException ex) { System.err.println("selectionForm.populate.picturefile: " + ex.getMessage()); logger.error("selectionForm.populate.picturefile: " + ex.getMessage()); } catch(IOException ex) { System.err.println("selectionForm.populate.picturefile: " + ex.getMessage()); logger.error("selectionForm.populate.picturefile: " + ex.getMessage()); } This is the .jsp code <tr> <td height="210" colspan="2" valign="top" align="center"> <!-- this is the photo section --> <div align="center"> <html:img action="/jpegServerAction.do" width="105" height="142" </div> </td> </tr> -----Original Message----- From: Gary Feidt [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 24, 2006 9:53 AM To: user@struts.apache.org Subject: Displaying Images from database using Struts tags Hi Everybody, I'm using Struts 1.2.4, with no frills (JSTL, Struts EL) - just using Struts framework and tags. I am exploring the ability to display images from database - never done this before. I'm guessing I can get the data out by using the java.sql.getBinaryStream Will the <html:img> tag display a java.io.InputStream, or is there a better way? Thanks, Gary __________________________________ Confidentiality Statement: This email/fax, including attachments, may include confidential and/or proprietary information and may be used only by the person or entity to which it is addressed. If the reader of this email/fax is not the intended recipient or his or her agent, the reader is hereby notified that any dissemination, distribution or copying of this email/fax is prohibited. If you have received this email/fax in error, please notify the sender by replying to this message and deleting this email or destroying this facsimile immediately. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- This transmission is intended only for use by the addressee(s) named herein and may contain information that is proprietary, confidential and/or legally privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]