The servlet that gets posted to performs some business logic via JavaBeans and then
forwards to the display page (in this case, the confirm.jsp) it never gets the output
stream and it doesn't include any other jsp's.
<sample code>
                    //save the changes and then send to confirm page
                    Customer tmpcust =
(Customer)req.getSession(false).getAttribute("tmpcust");
                    try{
                        logger.log("removing customer:"+tmpcust.getId(), logger.INFO);
                        this.clist.removeCustomer(tmpcust.getId());
                        logger.log("customer removed", logger.INFO);
                    }catch(Exception E){
                        logger.log(E, "error removing customer", logger.ERROR);
                        req.setAttribute("msg", "error removing customer, check logs");

                        this.send(req, resp, this.props.getProperty("error"),
"editcustomer");
                        return;
                    }
                    this.send(req, resp, this.props.getProperty("confirm"),
"editcustomer");
//snip
public void send(HttpServletRequest req, HttpServletResponse resp, String page, String
component) throws IOException, ServletException
    {
        RequestDispatcher rd = req.getRequestDispatcher("/"+component+"/"+page);
        rd.forward(req, resp);
    }
</sample code>
??? any clue?
Matt

Kitching Simon wrote:

> According to the sun servlet specs, you are **not allowed** to
> do a forward operation after having called a method to get the
> output stream, exactly as the message states.
>
> Are you sure you have never obtained an output stream
> before attempting to forward to "confirm.jsp" ??
>
> If you have something like
>   posted data --> servlet1
>   servlet1 does "include" for "handle-data.jsp"
>   servlet1 does "forward" to "confirm.jsp"
> then if handle-data.jsp obtains an output stream, this would
> exactly explain the problem.
>
> I suspect that the first thing *any* jsp page does is grab the
> output stream, have a look at the generated jsp code for
> "handle-data.jsp" or whatever your equivalent is.
>
> If your situation is different from what I have guessed, then
> please include more information in your next post - the page
> you included here looks ok, so the problem is probably in the
> upstream processing you didn't give any info about!
>
> Cheers,
>
> Simon
>
> > -----Original Message-----
> > From: Matt Goss [SMTP:[EMAIL PROTECTED]]
> > Sent: Thursday, January 04, 2001 4:23 PM
> > To:   [EMAIL PROTECTED]
> > Subject:      IllegalStateException???
> >
> > Hi everyone,
> > I just ported an applicaiton onto tomcat 3.2 that ran fine on JRUN 3.0.
> > The application consists of servlets that accept form posts from JSP's,
> > they process the data and then forward to other jsp pages. When I
> > forward to a specific page, the page displays fine, but I'm getting an
> > error message on my server screen :
> > <error message>
> > 2001-01-04 09:53:05 - Ctx( /rollout ):IllegalStateException in: R(
> > /rollout +/editcomponent/confirm.jsp + null) Cannot forward as
> > OutputStream or Writer has already been obtained
> > </error message>
> > the page is a simple confirmation page and looks like this:
> > <jsp page>
> > <html>
> > <head>
> > <title>CUSTOMER OPERATION CONFIRMATION</title>
> > <DEFANGED_meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> >
> > </head>
> > <body bgcolor="#FFFFFF">
> > <h1>The <%=request.getParameter("cmd")%> operation was successful!
> > :)</h1>
> > <a href="doeditcustomer.html">Return to the Customer list</a><br>
> > <a href="index.jsp">Return to navigation page</a>
> > </body>
> > </html>
> > </jsp page>
> >
> > does anyone have any idea what could be causing this???
> > Matt Goss << File: Card for Matt Goss >>  << File: ATT17765.txt >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
begin:vcard 
n:Goss;Matt
tel;fax:919-657-1501
tel;work:919-657-1432
x-mozilla-html:FALSE
url:www.rtci.com
org:RTCI;Custom Solutions
adr:;;201 Shannon Oaks Circle;Cary;NC;27511;US
version:2.1
email;internet:[EMAIL PROTECTED]
title:Web Developer
fn:Matt
end:vcard

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to