Markus Marzetta wrote:
>
> Hi!
>
> I have a potentially unbounded JSP displaying the results of a search
> and would like to define an error page for it using e.g.
>
>         <%@ page errorPage="jspErrorPage.jsp" isErrorPage="false" %>
>
> 1st problem: if the generated page grows and exceeds the buffer size,
> the buffer is flushed and, on exception, the error page is not
> displayed because an IllegalStateException occurs on the way.
>
>         java.lang.IllegalStateException: Cannot forward as OutputStream
>         or Writer has already been obtained
>
> so I tried setting
>
>         <%@ page autoFlush="false" %>
>
> 2nd problem: now, if the size of the generated page exceeds the buffer
> size we obviously get
>
>         java.io.IOException: Error: JSP Buffer overflow
>
> Question: How to solve these problems?
> --------

The best (only, at least for now) solution is to set a very large
buffer size or somehow limit the amount of output your JSP page can
generate.

> Maybe "buffer=none" solves the problem: Does anyone have experiences
> (perhaps even figures) on the costs in terms of performance?

No, with "buffer=none" there's no buffering at all so you will
get the java.lang.IllegalStateException as soon as an attempt is
made to forward to the error page.

> Thanks in advance,
>    Markus
>
> P.S. I'm using Tomcat.

In Tomcat 3.2 (at least I believe it made it into Beta 8), the error
handling has been modified so that if a forward can not be made
(due to a committed response resulting in IllegalStateException),
the error message will be "included" instead. I'm not 100%, but I
believe this applies to custom error pages as well. It's not perfect,
but it's better than the current situation. Try out Beta 8 and see how
it works for you.

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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