I have created a user defined exception say MyException.
I have got a exception class,business class and a servlet class. I throw exception from my business class to the servlet class.
In my web.xml i have
I also have a Exception.jsp also.
How to pass the user defined exception from servlet to my jsp page? I dont wish to use sendRedirect method!!!
Can any one please help me out??
SRV.9.9.2 Error Pages
The Web application may have declared error pages using the exception-type
element. In this case the container matches the exception type by comparing
the exception thrown with the list of error-page definitions that use the
exception-type element. A match results in the container returning the resource
indicated in the location entry. The closest match in the class heirarchy wins.
If no error-page declaration containing an exception-type fits using the
class-heirarchy match, and the exception thrown is a ServletException or
subclass thereof, the container extracts the wrapped exception, as defined by the
ServletException.getRootCause method. A second pass is made over the error
page declarations, again attempting the match against the error page declarations,
but using the wrapped exception instead.
It's a common newbie mistake to catch exceptions in the servlets and not wrap/throw them again.