This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Images,Template Text ,mime-type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Images,Template Text ,mime-type" Watch "Images,Template Text ,mime-type" New topic
Author

Images,Template Text ,mime-type

James Mark
Ranch Hand

Joined: Jul 05, 2007
Posts: 115
Consider the scenario in jsps..

Scriplet is used to read an image from the context root using streams.
contains the line
OutputStream os=response.getOutputStream();

Can we include any template text along with it?
I think it will lead to a line out.write("some string") in the generated Servlet corresponding to the jsp page.
there is a constraint that response.getWriter() and response.getOutputStream() cannot be called at the
same time!!!

Suppose I clicked a link and got some images and text in the webpage(as usual ...what is the mime type of the response? is it text/html or image/jpeg.
If a page contains two or more images,what actually comprise the response?
Do we need to send separate request for the images.

In the beginning of HFSJ there is a little talk about this.Please help me regarding this.


SCJP1.4(96%) SCWCD1.4(92%)
James Mark
Ranch Hand

Joined: Jul 05, 2007
Posts: 115
now I got it...
one is java.io.PrintWriter and other one is a javax.servlet.jsp.JspWriter....

please consider the next part in the Question....
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
I am assuming that you are using a JSP to generate an image tag or doing so yourself in the JSP. The return type is text/html. The browser, upon seeing the html image tag will open up another connection to retrieve the image. You do not have to be concerned with this connection. It will be done for you.
James Mark
Ranch Hand

Joined: Jul 05, 2007
Posts: 115
Thanks Michael
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Images,Template Text ,mime-type