Well basically: Write a servlet. In the processRequest(request, response) method obtain an InputStream for the binary DB object - the way you do this depends on how you're storing it in the DB (for example, if it's a BLOB field, then you need to obtain a java.sql.Blob from your result query then call Blob.getBinaryStream()).
Next, set the content type on the servlet response to "image/jpeg". Get the servlet output stream from the reponse object. Then all you need to do is read bytes from you're input stream and write them to the output stream until you run out of data. Close the streams and you're done. Hope this helps. Al. > -----Original Message----- > From: Emmanuel Eze [mailto:[EMAIL PROTECTED]] > Sent: 03 October 2002 11:55 > To: JDJList > Subject: [jdjlist] Encode a JPEG in JSP/Servlet > > > Hi, > > Can someone please advise me on how to serve a JPEG image > that is stored as a binary stream in a database? > > > Thanks > > > ____________________________________________________ > To change your JDJList options, please visit: > http://www.sys-con.com/java/list.cfm > > Be respectful! Clean up > your posts before replying > ____________________________________________________ > ____________________________________________________ To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm Be respectful! Clean up your posts before replying ____________________________________________________
