This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Stop - take a look at the source of any web page that has an image in it. What do you see? You see that the image data is not served with the HTML, instead there is an <img tag that has a src attribute which points to where the browser should obtain the image data. You can't create HTML plus image data in a single pass, the image has to come in a separate request. If you want a servlet to serve binary image data, your HTML page must be generated with a <img src="URL that points to the servlet. You are on the right track using an OutputStream - not a Writer. Be sure to set the response content-type to match the image encoding. If possible you should also set the content-length. Serving image and other binary resources comes up frequently, so do some searching. Bill
Joined: Feb 12, 2001
thanks a lot I have done it same way. thanks for replying.
subject: urgent - display Image (binary) + html in single page