In fact you can't forward AFTER the outputstream or the printwriter has been
used, and the data has been commited. The container should throw an
IllegalStateException, which is what you are seeing. Try using 'include'
instead of 'forward',
Kevin Jones
DevelopMentor
www.develop.com
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> Gareth Jones
> Sent: 17 January 2001 18:07
> To: [EMAIL PROTECTED]
> Subject: Re: Error! Please help
>
>
> It sounds like you have a servlet which is doing response.getWriter() (or
> response.getOutputStream()), then including or forwarding to
> another servlet
> which does it again and that isn't allowed - you can only get the
> outputStream once per response.
>
>
>
> >From: Amar Das <[EMAIL PROTECTED]>
> >Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> > Servlet API Technology." <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Error! Please help
> >Date: Wed, 17 Jan 2001 12:32:06 -0500
> >
> >My jsp page queries the database and formats the results returned. I am
> >using Tomcat Version 3.1 and IE 5 on a Win2K platform. I get 1st couple
> >of rows back in the formatted page and then receive the
> following error at
> >the bottom of the same page.
> >
> >Error: 500
> >Location: /dod/jsp/jcsdict/AdvancedFirstResults.jsp
> >Internal Servlet Error:
> >java.lang.IllegalStateException: Cannot forward as OutputStream or Writer
> >has already been obtained
> > at
> >org.apache.tomcat.core.RequestDispatcherImpl.forward(RequestDispa
> tcherImpl.java:130)
> > at
> >org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl
> .java:357)
> > at
> >org.apache.jasper.runtime.PageContextImpl.handlePageException(Pag
> eContextImpl.java:381)
> > at
> >jsp.jcsdict._0002fjsp_0002fjcsdict_0002fAdvancedFirstResults_0002
ejspAdvancedFirstResults_jsp_17._jspService(_0002fjsp_0002fjcsdict_0002fAdva
ncedFirstResults_> 0002ejspAdvancedFirstResults_jsp_17.java:459)
> > at
> >org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> >org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(Js
> pServlet.java:174)
> > at
> >org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
> > at
> >org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> >org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrappe
> r.java:503)
> > at
> >org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> > at
> >org.apache.tomcat.service.http.HttpConnectionHandler.processConne
> ction(HttpConnectionHandler.java:160)
> > at
> >org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoi
> nt.java:338)
> > at java.lang.Thread.run(Thread.java:484)
> >
> >If the run the same query from an SQL prompt it runs OK without resulting
> >in any error. I have not been able to find the source of the error and
> >hence any remedy. Please help!
> >
> >
> >====================================================================
> >++ Amarjyoti Das
> >
> >++ email: [EMAIL PROTECTED]
> >
> >++ phone: (207) 594-3048 x 30
> >
> >++ fax:(207) 594-3021
> >
> >++ web: www.stgeorgeconsulting.com
> >
> >====================================================================
> >
> >_________________________________________________________________
> __________
> >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
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
> __________________________________________________________________
> _________
> 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