- Configure declaration exception handling for the current action
1. There are 2 attributes in the exception-mapping element
Exception: Specifies the type of exception that needs to be caught
Result: Specifies a response result that will be executed when the exception is caught. That is, you can come from a declaration of the current action, or from a global-results declaration.
2. You can display the exception message through the <s:property> tab on the view.
- You can provide a global exception-capture mapping for your application through the global-exception-mappings element.
1, but any exception-mapping element declared under the Global-exception-mappings element can only refer to a result element declared under the Global-results element.
- The declarative exception-handling mechanism is handled by the Exceptionmappinginterceptor interceptor.
1. When an exception declared by an exception-mapping element is captured, the Exceptionmappinginterceptor interceptor adds two objects to the Valuestack:
Exception: Exception object that represents the exception being caught
Exceptionstack: The stack containing the caught exception
Struts (12): Exception handling: exception-mapping elements