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 1. - no included page
----------

<%@ page language="java" errorPage="error.jsp" %>
......
<%
if ("test".equals("test") { throw new Exception("this is the exception") }
%>


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") }
%>


Example 3. - included page after exception
----------

<%@ page language="java" errorPage="error.jsp" %>
......
<%
if ("test".equals("test") { throw new Exception("this is the exception") }
%>
<jsp:include page="anExamplePage.jsp" flush="true"/>
.....


In the first and third examples my error page is displayed properly and the
stack trace appears fine.

In the second example my error page does not appear but the "Attempt to
clear a buffer that's already been flushed" stack trace is displayed.

This is a fairly serious problem that it seems a lot of developers are
experiencing and nobody seems to know a workaround.

Are other people experiencing this problem? Is there something obvious I am
doing wrong here?

Note: I can reproduce this problem using Tomkat 3.0 and JavaWebser2.0 so it
doesnt seem to be limited to a single vendor or JSP specification.

I would be extremely grateful if someone could help me (and the other 10
people) out.

Thanks
Matt Krevs

===========================================================================
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

Reply via email to