I Like to implement Front Controller design pattern in Exception handling as follows
1)I have to collect all exception(from all action) in a center place(hope action servlet fit in to this) ,there I analyze all exception and throw appropriate message to user
2) Can i Use Error code in Global Exception ?,I read Global Exception,there I found that ,i have to specify Exception type.Please correct me If i am wrong
Joined: Feb 15, 2005
Originally posted by jacob deiter: 1)I have to collect all exception(from all action) in a center place(hope action servlet fit in to this) ,there I analyze all exception and throw appropriate message to user
Declaring a global exception fits this requirement perfectly. All you have to do is declare a handler for exception java.lang.Exception and all exceptions thrown by an Action class will go to this handler. In your handler you can analyze the exception and pretty much do whatever you want, including logging the exception and forwarding to an error page.