org.apache.struts.action
public class ExceptionHandler extends Object
An ExceptionHandler is configured in the Struts
configuration file to handle a specific type of exception thrown
by an Action.execute
method.
Since: Struts 1.1
Field Summary | |
---|---|
static Log | log Commons logging instance. |
static MessageResources | messages The message resources for this package. |
Method Summary | |
---|---|
ActionForward | execute(Exception ex, ExceptionConfig ae, ActionMapping mapping, ActionForm formInstance, HttpServletRequest request, HttpServletResponse response) Handle the |
protected void | logException(Exception e) Logs the |
protected void | storeException(HttpServletRequest request, String property, ActionError error, ActionForward forward, String scope) Default implementation for handling an |
protected void | storeException(HttpServletRequest request, String property, ActionMessage error, ActionForward forward, String scope) Default implementation for handling an |
Commons logging instance.
The message resources for this package.
Handle the Exception
.
Return the ActionForward
instance (if any) returned by
the called ExceptionHandler
.
Parameters: ex The exception to handle ae The ExceptionConfig corresponding to the exception mapping The ActionMapping we are processing formInstance The ActionForm we are processing request The servlet request we are processing response The servlet response we are creating
Throws: ServletException if a servlet exception occurs
Since: Struts 1.1
Logs the Exception
using commons-logging.
Parameters: e The Exception to log.
Since: Struts 1.2
Deprecated: Use storeException(HttpServletRequest, String, ActionMessage, ActionForward, String) instead. This will be removed after Struts 1.2.
Default implementation for handling an ActionError
generated
from an Exception
during Action
delegation. The default
implementation is to set an attribute of the request or session, as
defined by the scope provided (the scope from the exception mapping). An
ActionErrors
instance is created, the error is added to the collection
and the collection is set under the Globals.ERROR_KEY
.
Parameters: request The request we are handling property The property name to use for this error error The error generated from the exception mapping forward The forward generated from the input path (from the form or exception mapping) scope The scope of the exception mapping.
Default implementation for handling an ActionMessage
generated
from an Exception
during Action
delegation. The default
implementation is to set an attribute of the request or session, as
defined by the scope provided (the scope from the exception mapping). An
ActionMessages
instance is created, the error is added to the
collection and the collection is set under the Globals.ERROR_KEY
.
Parameters: request The request we are handling property The property name to use for this error error The error generated from the exception mapping forward The forward generated from the input path (from the form or exception mapping) scope The scope of the exception mapping.
Since: Struts 1.2