On Fri, May 31, 2002 at 03:21:19AM -0700, Sergey Sinelnichenko wrote:
> process exception. But sometimes, output of "/app_error.jsp" page
> APPENDS to output of page, where an exception occur (error-fire
> [...]
> 
> What is it, and how may I fix this behaviour?

When something in your JSP throws an exception, some special errorPage
handler code tries to forward the user to the error page you specified
by using an HTTP redirect response.

The problem is, you can only send one HTTP response per user request,
which means you can't send an HTTP redirect header to the user if
you've already started sending data to the user.

The way JSP gets around that problem is that your output data gets
saved in a server-side buffer for a little while before being sent to
the user.  If an exception happens in your JSP's code, the server will
throw out all that buffered data and send an HTTP redirect to the
error page instead of sending an HTTP "ok" header.

The JSPWriter's output buffer doesn't have unlimited capacity though,
and the server will eventually start sending data to the user even
before your JSP is finished executing.  If an exception gets thrown
after the server has started sending data, the forward will be
impossible, and the best alternative will be to append the error page
instead of forwarding to it.

You might be able to optimise your JSP so that all of the code that
might cause exceptions gets executed before you've tried to write out
much HTML.  You might also be able to increase the size of the
JSPWriter's buffer enough to avoid sending the data before your
exception gets thrown.

Happy coding!  It's Friday afternoon and I'm headed home!

-- 
Jonathan Fuerth - SQL Power Group Inc.
(416)218-5551 (Toronto); 1-866-SQL-POWR (Toll-Free)
Unleash the Power of your Corporate Data - http://www.sqlpower.ca/

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to