I have a JSP that is not catching an exception like it's supposed to. I
have 'errorPage' set in the page directive, and pointing to the appropriate
page. The error page itself _works_, because I can get it to catch exceptions
and display info, but not in this situation:
I'm calling a method that throws an SQLException. Method definition:
public boolean addNewUser(userInfo ui) throws SQLException {
In the method I'm calling other methods that throw SQLExceptions, but I need to
do some preprocessing before passing the exception up the call stack, so I catch
the exception, do my stuff, then throw a new exception with added information:
catch(SQLException e) {
System.out.println("SQLException thrown, just caught it.\n");
e.printStackTrace();
returnVal = 0;
throw new SQLException( "my message" + e.getMessage() );
}
(I'm not even sure if I need to throw a _new_ exception, but I was experimenting
TRYING to get this to work!)
The problem is my JSP page never catches the exception! Yet, I've learned
through experimenting that the page _will_ catch the exception if I remove the
try/catch blocks completely and just allow it to pass on up the call stack, but
this isn't really an option to me.
I have no idea why this is not working right, and I can't see what I'm doing
wrong exactly.
Help appreciated! <sigh>
Brian Slezak
===========================================================================
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