1) Servlet Filters in orange, the Filter chain. All requests must be processed by the Filter chain. (2) light blue is the Core part of Struts Core and Struts2. The functions provided by Struts2 do not need to be updated during actual development. (3) light green is Interceptors, Struts2 interceptor. Struts2 provides many default interceptors to complete most of the daily development work. Of course, you can also customize the Interceptor to implement the functions required by specific businesses. (4) The light yellow is User Created, which is Created by developers, including struts. xml, Action, and Template. It is required by every developer who uses Struts2 for development. (2) description of each module (1) FilterDispatcher is the scheduling center of Struts2. It determines whether to process the request based on the ActionMapper results. If ActionMapper points out that the URL should be processed by Struts2, then it will execute Action processing and stop the filter that has not been executed on the filter chain. (2) ActionMapper provides a ing between HTTP requests and action execution. Simply put, ActionMapper determines whether the request should be processed by Struts2. If Struts2 is required, actionMapper returns an object to describe the corresponding ActionInvocation information of the request. (3) ActionProxy is a special middle layer between Action and xwork, which gives you the opportunity to introduce more implementation methods in the future, such as WebService. (4) ConfigurationManager is the Management Center of xwork configuration. In general, it can be seen as the corresponding configuration file struts. xml in memory. (5) struts. xml is the application configuration file of Struts2, which is responsible for configuration of ing between URL and Action, and Result configuration of page jump after execution. (6) ActionInvocation: Call and execute an Action. It has an Action instance and the interceptor instance on which the Action depends. ActionInvocation will execute these interceptors, actions and corresponding results. (7) Interceptor: the Interceptor is a stateless class that can automatically intercept Action, they provide developers with the opportunity to execute some functional code before or after the Action is run, similar to javax. servlet. filter. (8) Action: The Action Execution Unit in Struts2. It is used to process user requests and encapsulate the data required by the business. (9) Result: Result is an abstract encapsulation model of different view types. Different view types correspond to different Result implementations. Struts2 supports multiple view types, such as Jsp and FreeMarker. (10) Templates: Page Templates of various view types. For example, JSP is a template page technology. (11) Tag Subsystem: The Tag library of Struts2, which abstracts different view technologies JSP, velocity, and freemarker in 3, which can be used in different view technologies, these labels are almost identical. (3) The Struts2 running process first recalls what we did in Chapter 2nd-Struts2's HelloWorld program: (1) on the web. the Struts2 filter configured in xml (2) writes an Action class named HelloWorldAction (3) in Struts. this Action class is configured in xml (4) and two pages are written. One is the logon page and the other is the welcome page, the function call can be completed with the help of Struts2. How does Struts2 run internally? The following is an analysis based on the architecture diagram: (1) first, on the login page, enter the user's account and password, and then click Submit. Then, we will start to analyze the process behind the analysis, this is the starting point of our analysis. (2) After a user submits a login request, the request URL is helloWorldAction. action. The request is received by the Tomcat server. The Tomcat server selects the web application that processes the request based on the Web context in the request URL, that is,/Struts2_2, that is, the request is handled by the/Struts2_2 web project. Copy the Code <form action = "helloWorldAction. action "method =" post "> <input type =" hidden "name =" submitFlag "value =" login "> account: <input type = "text" name = "account"> <br/> password: <input type = "password" name = "password"> <br/> <input type = "submit" value = "submit"> </form> copy the code (3) the Web Container will read the web of the Struts2_2 project. xml, in the web. xml configuration, found the extension is. action requests are processed by the Struts2 Filter. According to the Filter configuration, find the actual class as FilterDispatcher. (4) The Web Container will obtain the FilterDispatcher class. And then calls back the doFilter Method for real processing. As the front-end controller, FilterDispatcher is the call center of Struts2.