Struts (12): Exception handling: exception-mapping elements

Source: Internet
Author: User

    • 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.