public ActionForward execute ( ActionMapping mapping , ActionForm form , HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { log . fine ( "ActionForward perform(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse): called" ) ; // Build an ActionErrors object to hold any errors that occurr ActionErrors errors = new ActionErrors ( ) ; // Create reference to the session HttpSession session = request . getSession ( ) ; // Use a try block to catch any errors that may occur try { return executeWithErrorHandling ( mapping , form , request , response , errors ) ; } // Catch all exceptions here. This will forward to the error page in the event of // any exception that falls through to this top level handler. // Don't catch Throwable here as Errors should fall through to the JVM top level and will result in // termination of the application. catch ( Exception t ) { log . log ( Level . WARNING , "Caught a Throwable" , t ) ; // Don't Forward the error to the error handler to interpret it as a Struts error as the exception will // automatically be translated by the error page. // @todo Could add code here to check if there is a 'error' forward page defined. If there is then call // the error handler to translate the throwable into Struts errors and then forward to the 'error' page. // This would mean that the error page defined in web.xml would be the default unless an action explicitly // defined an alternative 'error' forward. // handleErrors(t, errors); // Save all the error messages in the request so that they will be displayed // request.setAttribute(Action.ERROR_KEY, errors); // Rethrow the error as a ServletException here to cause forwarding to error page defined in web.xml throw new WrappedStrutsServletException ( t ) ; } }
Processes the action providing default error handling . Implementation should override this method to provide their own error handling if the default is not to be used .