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