Process of STRUTS2 Framework

Source: Internet
Author: User

The processing of a request in the STRUTS2 framework is likely to go through the following steps:

    • 1. The client issues a request to the Servlet container (for example, Tomcat).

    • 2. This request passes through several filter filters (actioncontextcleanup optional filters, other WEB filters such as Sitemesh, etc.) and finally arrives at the Filterdispatcher filter.

    • 3, then Filterdispatcher filter is called, Filterdispatcher asked Actionmapper to decide whether this need to call an Action.

    • 4. If Actionmapper decides that a action,filterdispatcher needs to be called to the agent (Actionproxy) of the Action object for the processing of the request.

    • 5. Actionproxy reads the relevant configuration file for the framework (Struts.xml and the *.xml configuration file it contains) through Configuration Manager to find the Action class that needs to be called.

    • 6. After finding the Action class that needs to be called, Actionproxy creates an instance of Actioninvocation.

    • 7. Actioninvocation invokes the relevant configuration interceptor (Intercepter) in turn before invoking the Action procedure, and the result string is returned by execution.

    • 8, Actioninvocation is responsible for finding the result string corresponding to the results, and then execute this result, and then return the corresponding result view (such as JSP, etc.) to render the page.

    • 9. Call the configured interceptor again (the call sequence is the opposite of the 7th step), then the response (HttpServletResponse) is returned to the browser.

Advantages of STRUTS2:

    • Struts2 is a non-intrusive design that does not rely on the servlet API and the Struts API.

    • STRUTS2 provides a powerful interceptor that enables AOP programming (aspect-oriented programming) with interceptors, such as permission interception.

    • STRUTS2 provides a type converter that makes it easy to type conversions, such as converting special request parameters into the desired type.

    • STRUTS2 supports a variety of presentation technology, such as JSP, Freemarker, vectocity, etc.

    • The input validation of the STRUTS2 allows the specified method to be validated.

Process of STRUTS2 Framework

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.