1. In the JSP page that include both image and other html text, the standard way to get an image is <img src="myIgameFile.gif">. So do you mean servlet HAS to generate an image file and JSP just refer to that file ?
servlet doesnt generate
2. Is it possible for servlet NOT to generate a image file and JSP can still directly get it ? If so,Could you write few lines sample ?
Originally posted by William Brogden:
Stop and think about what a HTML page that contains an image looks like.
Right! it has an img tag with an href to the source of the image. You can't mix the binary data of an image with the character data of an HTML page.
Your MyJsp.jsp page has to generate an img tag with an href pointing to the image generating servlet. The servlet has to generate binary data (ie OutputStream, not Writer) and must set the headers for content type and content length.
Most servlet books (mine included) discuss this.
Bill
James Carman, President<br />Carman Consulting, Inc.
2. Is it possible for servlet NOT to generate a image file and JSP can still directly get it ? If so,Could you write few lines sample ?
** SCJP1.4 **
Oh the stink of it! Smell my tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|