I think you are missing out on some usefull features by using this. You can't use the ActionMapping Parameter property to distinguish operations <action ... parameter="add" ... /> and you will have to reimplement a solution if you use DispatchAction. I think there are benefits to declaritive exception handling, flexibility.
Mark -----Original Message----- From: Ole Hildebrandt [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 15, 2005 12:21 PM To: 'Struts Users Mailing List' Subject: AW: Proper n tiered exception handling Hi. My personal opinion is, that the Struts Exception handling doesn't bring any benefits. I use an approch based on inheritance and the "Template Method"-Pattern from the GoF: I create an abstract Class extended from "Action". All application-Specific Actions extend that class. The Abstract Action-class is responsible for catching all Exceptions that were not explicitly catched by the extending class. Source-Snippet from the Abstact Class "AbstractContoller.java": public abstract class AbstractController extends Action { //Template-Method. Calls "doExecute" on each Request and handles uncaught Exceptions: public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { try { return doExecute(mapping,form, request,response); } catch (Throwable e) { request.setAttribute("messagekey","error.unknownError"); log.error("Uncought Exception",e); return mapping.findForward("error"); } } //All extending classed implement this method public abstract ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception ; And I use ExceptionChaining. See this article for more info: http://www.javaworld.com/javaworld/jw-09-2001/jw-0914-exceptions.html? Kind Regards Ole -----Ursprüngliche Nachricht----- Von: Brian McGovern [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 15. Februar 2005 16:28 An: user@struts.apache.org Betreff: Proper n tiered exception handling I'm looking to get a handle on best exception handling practices in my app. Kinda beginner question i guess, sorry. Im catching the various sql and naming exceptions in the data classes and logging and throwing a custom exception called ApplicationException which is blank and provided below. I've read up but an still a little confused on how exactly to build this exception class to extend the available struts exception classes that would gracefully map to an error display jsp where i could display the error to the user. Right now I just get the HTTP status 500 strack trace on the screen. Controller snippet that catches the data obj's thrown ApplicationException: ------------------------------------------------------------------------ try { zRepBeanBn = MyData.getRepByID(StringUtils.convertToInt(request.getParameter("RepID"))); }catch (ApplicationException zAppEx){ throw zAppEx; } ------------------------------------------------------------------------ ApplicationException that needs work: How do I extend this? ------------------------------------------------------------------------ public class ApplicationException extends Exception { public ApplicationException(String message) { } } ------------------------------------------------------------------------ Thanks --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]