Matt (and the 10 other people)-
I can see why the problem happens with Tomcat since it calls out.clear()
before it calls pageContext.handlePageException. Since the Tomcat code came
from Sun originally, I'm not entirely surprised that JWS also does it. I
tried your example with JRun (www.allaire.com) and Resin (www.caucho.com)
and I did not get an error. I tried some other funky things to try to get
Tomcat to work, but I just couldn't. I'm still running Tomcat 3.0 here,
though, so I can't tell you if 3.1 fixes it. I imagine that just calling
clearBuffer instead of clear would fix the problem, but the behavior may be
intentional.
One thing about using JRun or Resin for this, you do see the text message
from the included page before you see the exception. I don't think there is
any way that you can include a page then throw an exception and expect the
original output to go away, since including a page requires that the buffer
is flushed.
Mark
----- Original Message -----
From: "Matt Krevs" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 02, 2000 2:24 AM
Subject: 3rd posting - error reporting and included pages
> Does anyone know how to get errors properly reported in JSP pages that
have
> included pages?
>
> I have posted this question a few times now and the only responses I have
> received (and there have been about 10) have been from other tortured
souls
> that are experiencing the same problem without having found a solution.
>
> Basically the problem is that I _always_ receive the following error if
any
> exception is raised in a JSP after a jsp:include
> on the page
>
> "javax.servlet.ServletException: Error: Attempt to clear a buffer that's
> already been flushed
> at org.apache.jasper.runtime.JspServlet.service(JspServlet.java,
Compiled
> Code) etc...."
>
>
>
> Example 2. - included page before exception
> ----------
>
> <%@ page language="java" errorPage="error.jsp" %>
> ......
> <jsp:include page="anExamplePage.jsp" flush="true"/>
> <%
> if ("test".equals("test") { throw new Exception("this is the exception") }
> %>
>
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets