error handling in jsp

hi

how do we handle errors in JSP.

If/when I get an exception in my jsp , I want to forward to a new page giving a message to the user .

I tried the <%@ page errorPage =error.jsp%> but did not really work well , tried to catch exception in controller and forward to another jsp , then I got an response committed exception

What is the best way to acheive what i need here

TIA

[418 byte] By [am_newa] at [2007-11-26 16:06:08]
# 1
hope someone would have done this ?
am_newa at 2007-7-8 22:28:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
I can display the error page when there is an error using the directive , but it overlays on the data that is already committed on the page.I have added 3 dukes , help
am_newa at 2007-7-8 22:28:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Once the response is committed there is nothing you can do about it. You can't call it back and change your mind, because you've already sent it down the pipe.

Possible solutions:

- catch the error before you start rendering (I'm not sure where the error is coming from in your system, so that might not be feasible)

- use a larger buffer (<%@ page buffer="16kb" %> (won't stop the problem, but will hide it for smaller pages)

How large is the result page you are sending?

evnafetsa at 2007-7-8 22:28:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

thanks for the response

I handle most of the errors in DAO and controller if possible

These are the exceptions that happend once in a while in the middle of the page in a jsp.

I tried increasing the buffer but it overflowed in certain JSP's. Is advisable to increase the limit of the buffer?

am_newa at 2007-7-8 22:28:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...