Introduction to struts
1、 What is struts
2、 Struts 2 Architecture
1. The client sends a request to the servlet container (such as Tomcat).
2. The request will pass through several filters (actioncontextcleanup optional filter, other web filters such as SiteMesh, etc.) and finally reach the filterdispatcher filter.
3. Then the filterdispatcher filter is called. The filterdispatcher asks actionmapper to decide whether to call an action.
4. If actionmapper decides that an action needs to be called, the filterdispatcher hands over the processing of the request to the action object's proxy (actionproxy).
5. Actionproxy reads the relevant configuration files (struts.xml and its *. XML configuration files) of the framework through the configuration manager to find the action class to be called.
6. After finding the action class to be called, actionproxy will create an instance of actioninvocation.
7. Actioninvocation will call the relevant configuration interceptors in turn before calling the action process, and the execution result will return the result string.
8. Actioninvocation is responsible for finding the result corresponding to the result string, then executing the result, and then returning the corresponding result view (such as JSP, etc.) to render the page.
9. Call the configuration interceptor used again (the calling sequence is opposite to step 7), and then the response (httpservletresponse) is returned to the browser.
3、 Advantages of struts 2
1. Struts 2 is a non intrusive design, that is, it does not depend on servlet API and struts API
2. Struts 2 provides a powerful interceptor, which can be used for AOP programming (aspect oriented programming) to realize functions such as permission interception.
3. Struts 2 provides a type converter, which is convenient for type conversion, such as converting special request parameters into required types.
4. Struts 2 supports a variety of presentation layer technologies, such as JSP, FreeMarker, vectocity, etc.
5. The input verification of struts 2 can verify the specified method.
reference resources:
https://www.lanqiao.cn/courses/reports/1372104/