File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Images,Template Text ,mime-type" Watch "Images,Template Text ,mime-type" New topic

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 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
I agree. Here's the link:
subject: Images,Template Text ,mime-type
It's not a secret anymore!