| Article: |
An Exception Handling Framework for J2EE Applications | |
| Subject: | ? | |
| Date: | 2006-01-13 06:04:32 | |
| From: | namakemono | |
|
just use struts declarative exception handling, and either write your own exception handler or use the default one (making sure your log4j.properties log level is set to debug for the exceptionhandler class).
|
||
Showing messages 1 through 1 of 1.
-
?
2006-01-13 09:13:37 Shrik [View]



Most of the time we would like to generate an ActionError and display it to the
user instead of displaying an error page. Let us take an example:
When XmlParseException is thrown, the user sees error.jsp. This makes sense since XmlParseException is a system exception and the only thing you can do is to ask the user to start all over again. However, it may not make sense to do so when NoRecordFoundException is thrown since this is an application exception from which the user has a recovery path. A better option is to show this as an ActionError and give the user a chance to change search criteria. For situations like this, you have to resort to programmatic
exception handling. And that's what we are doing in the article.
In this article we also discussed about context sensitive exceptions. We can have multiple messages for the same exception based on the context specified. I don't think if you could achieve the same using Struts based declaritive exception handling.