Figure 1:
The
comes from the STRUTS2 official site, which is the overall structure of struts 2.
The processing of a request in the STRUTS2 framework is roughly divided into the following steps
1 Client Initializes a request to a servlet container (for example, Tomcat)
2 This request passes through a series of filters (filter) with an optional filter called Actioncontextcleanup, which is useful for integration of Struts2 and other frameworks , for example: Sitemesh Plugin)
3 then Filterdispatcher is called, Filterdispatcher asked Actionmapper to decide whether or not to call a action ,
4 If Actionmapper decides that an action needs to be called, Filterdispatcher the processing of the request to actionproxy
5 actionproxy asks the configuration file of the Framework via Config Manager, Locate the action class that you want to call;
6 Actionproxy Create an instance of Actioninvocation. the
7 Actioninvocation instance is invoked using a naming pattern that involves a call to the relevant interceptor (Intercepter) before and after the procedure that invokes the action.
8 Once the action is executed, Actioninvocation is responsible for finding the corresponding return result based on the configuration in 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. In this process, it is necessary to involve actionmapper
all objects in the above procedure (Action,results,interceptors, etc.) are created through Objectfactory.
The implementation principle of struts interceptor