Hi I have a .gif image stored in a byte array : public byte picture; I really do not want to write to a file first, and then use getImage() method to display the picture because it is an i/o overhead. Are there any other ways of doing this ???
Basically you want to have the image data served by a servlet from the byte array instead of the web server from a file. You have to arrange that the URL in the <img> tag points to a servlet that has the byte array. You have to set the response content-type to "image/gif" and the content-length to the byte.length. See the HttpServletResponse API. You MUST get an output stream instead of a writer so the bytes will go out unaltered. Then just write the byte array and close the stream. This is a common item in many servlet books and you can find plenty of related discussions in older threads here. Bill