The main difference between SpringMVC and Struts2

The main difference between SpringMVC and Struts2.
①The entrance of springmvc is a servlet, that is, a front-end controller, (DispatcherServlet),
and the entrance of struts2 is a filter.


Point 2 of which must be recited:

② springmvc is based on method development, passing parameters through method parameters, and using ThreadLocal technology, the passed parameters are isolated in each thread, so it is thread-safe. Therefore, the design can be designed as a singleton, then @Scope("prototype") does not need to be written, because if it is not written, the default is a singleton to greatly improve the operating efficiency, which will crush struts.

Struts2 is based on class development, and the parameters are passed through the properties of the class, which can only be designed for multiple cases.
@Scope("prototype") must be used, otherwise it is not thread safe and problems will occur.
------------------------

③Struts2 uses [value stack] to read and write data, Springmvc encapsulates the response data and page into ModelAndView objects, and finally transfers the model data to the page through the request object. Jsp view parser uses jstl by default

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324775667&siteId=291194637