This content has been marked as final.
Show 2 replies
-
1. Re: Exception handling and error in general
peterj Nov 25, 2008 3:10 PM (in response to maz00)I recommend that the method making the Class.forName() call not catch the exception, or perhaps repackage the caught exception into another exception and throw that. Then let the caller catch the exception. In your case, the code in your JSP would have to catch the exception and generate html to display an error.
If you do not do this, you would need some other mechanism to propagate the fact that an exception happened, which means that you are just re-inventing exception handling, and it will mean a fair bit of coding that you can avoid by simply using the exception mechanisms. -
2. Re: Exception handling and error in general
peterj Nov 25, 2008 3:14 PM (in response to maz00)Oh, one other though. You can have the JSP ignore the exception, and then in your web.xml place an error handler that will display an error page:
<error-page> <exception-type>java.lang.Exception</exception-type> <location>/error.html</location> </error-page>