Reply below.

> ----------
> From:         Tom John[SMTP:[EMAIL PROTECTED]]
> Reply To:     A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology.
> Sent:         Wednesday, November 03, 1999 3:04 AM
> To:   [EMAIL PROTECTED]
> Subject:      setContentType
>
> Hi,
>
> What I wan't to know is that by any chance if I want to use the
> setContentType twice
>
Broadly speaking, content type tells the client (the browser in this case)
the type of information following.
In case of an html document you would set it to "text/html". You can set the
content type to any valid MIME
type. You can find more information on MIME at -
http://www.hunnysoft.com/mime/

>  How can I do it.It gives (have a look at the following
> code)
> errors but if I pass the res object(which is declared in UdpateExam)as
>  getMaxExamId(HttpServletResponse res)  it works. Why is that?
>
> Other Question is,
> Let me know what is the meaning of setContentType can be used once. Does
> it
> to a particular object
> or what.
>
>
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> class TimeTable{
>
> ....
> ....
>
> //---------------
> public long  getMaxExamId()  throws ServletException,IOException
>   {
>        ...
>        ...
>        HttpServletResponse res1=null;
>        res1.setContentType("text");
>
// You are setting the HttpServletResponse object 'res1' to null. You cannot
invoke any methods on a null object.

>        PrintWriter out=res.getWriter();
>    .......
>
> ......
>
>
>    }
> //----------------
>
>
> public void UdpateExam(HttpServletResponse res) throws
> ServletException,IOException
>  {
>        ResultSet rs=null;
>        res.setContentType("text/html");
>        PrintWriter out=res.getWriter();
>
The above will work as long as the HttpServletResponse object being passed
in (res) is good (not null).

> ...
>
> __________________________________________________________________________
> _
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to