Is it bad form to put most of your code in a try catch block? I am using an error page to catch my exceptions but some of them are slipping through.

Bozidar Dangubic

you can use web.xml to specify error pages to display if any exception occurs. look through the faq and you will see an example of web.xml that accomplishes just that. you can now only specify which pages to display when certain exceptions occur but also when certain HTTP error codes are to be returned (like 404-File Not Found or 500-Internal Server Error). do not use try-catch blocks in your JSPs for the sole purpose of trying to catch every possible thing that can happen so that clients do not see the exception trace. web.xml is there for that. use try-catch in your JSP when API requires or when you know how to recover and dispose resource when some exception occurs.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact