How does the struts2.0 work?

Source: Internet
Author: User

Struts2 is not a strange web framework, it is based on webwork design ideas as the core, absorbing the advantages of struts1, it can be said that STRUTS2 is the combination of struts1 and webwork products. How STRUTS2 works: a request for processing in the STRUTS2 framework is divided into the following steps: 1. The client issues a request to the servlet container (Tomcat) ; 2. This request passes through several filters in the diagram and finally reaches the Filterdispatcher filter. 3. Filter Filterdispatcher is the heart of the STRUTS2 framework, which, when processing a user request, interacts with the request to access Struts2 's underlying framework structure.  When the Web container starts, the STRUTS2 framework automatically loads the relevant parameters in the configuration file and transforms them into the appropriate classes. such as: ConfigurationManager, Actionmapper and Objectfactory. ConfigurationManager has some basic information about the configuration file, and Actionmapper has the configuration information for the action. All objects (action,results, interceptors, etc.) are created through objectfactory during the request. The filter asks the Actionmapper class to find the action that is needed in the request. 4. If you find the action that needs to be called, the filter will hand over the processing of the request to Actionproxy. Actionproxy is the proxy object for the action. Actionproxy asks the framework's configuration file through ConfigurationManager to find the action class that needs to be called. 5.ActionProxy creates an instance of Actioninvocation. Actioninvocation below the Actionproxy layer, it represents the execution state of the action, or the execution step of the action it controls. It holds the action instance and all the Interceptor. The 6.ActionInvocation instance uses a naming pattern to invoke, 1. When Actioninvocation is initialized, all interceptor associated with the action are loaded according to the configuration. 2. When the action implementation is invoked by the Actioninvocation.invoke method, the interceptor is executed. A call to the relevant interceptor (Intercepetor) is involved before and after the action is invoked. 7. Once the action is executedActioninvocation is responsible for finding the corresponding return result based on the configuration in the Struts.xml. The return result is usually (but not always, possibly another action chain) a JSP or freemarker template that needs to be represented. The tags inherited in the STRUTS2 framework can be used in the representation process.

How does the struts2.0 work?

Related Article

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.