||An Exception Handling Framework for J2EE Applications|
Response to: ?
There are reasons why we didn't (rather couldn't) use the Struts declaritive exception handling. First of all, as already mentioned in the article, discussed strategy can be applied anywhere irrespective of whether you are using Struts or any other presentation framework. It can be even used in standalone Java programs also without any changes. So, the target was to have an exception handling framework which could be used anywhere seamlessly. Other reason leads us to understand where to use and where not to use the Struts declaritive exception handling.
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.
2006-01-16 23:15:21 sumitaj [View]