The difference between spring mvc and struts

Compare the difference between strus2 and spring3 mvc 

=========================================== ===  The
struts2 framework is a class-level interception . Every time a request comes, an Action is created, and then the setter getter method is called to inject the data in the request into
struts2. In fact, in 
struts2, which deals with the request through the setter getter method, an Action object Corresponding to  a request context 

, spring3 mvc is different. spring3mvc is a method - level interception . After intercepting the method, according to the annotations on the parameters, the request data is injected into
spring3mvc.  The interception , a class corresponds to a request context,  springmvc is a method-level interception , a method corresponds to a request context, and a method corresponds to a url at the same time, so from the architecture itself, spring3 mvc is easy to implement restful url  and struts2 architecture implementation It takes a lot of effort  because a method of struts2 action can correspond to a url  but its class attribute is shared by all methods, so it is impossible to use annotations or other methods to identify the method to which it belongs. 









================================== 
The methods of spring3mvc are basically independent and share the request response data exclusively 
The request data is obtained through parameters, and the processing results are returned to the framework through ModelMap 
. Variables are not shared between methods, 

and struts2 is messy. Although the methods are also independent, all their Action variables are shared, 
which will not affect the operation of the program. , but it brings trouble to us when coding and reading programs 

===================================== 
spring3 mvc Validation is also a highlight. Supporting JSR303 
to handle ajax requests is even more convenient. Just annotate @ResponseBody and return the response text directly. 

 

Source: http://blog.csdn.net/generalyy0/article/details/7003974

Guess you like

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