Difference between Struts and Spring MVC

 

  

1. Mechanism. The entrance of spring mvc is servlet , and struts is filter (it should be pointed out here that filter and servlet are different. In the past, filter was considered to be a special kind of servlet), which led to different mechanisms of the two.

2. Performance. Spring will be slightly faster than struts. Spring mvc is a method -based design, while sturts are class-based . Every time a request is made, an action will be instantiated, and each action will be injected with attributes, while spring is method-based and has a finer granularity, but it should be carefully controlled like in servlet control Data is the same.

3. Parameter passing. When struts accepts parameters, it can use attributes to accept parameters, which means that parameters are shared by multiple methods.

4. Design thinking . Struts is more in line with the programming ideas of oop , and spring is more cautious and expands on servlets .

5. Implementation mechanism of intercepter. Struts has its own interceptor mechanism, and spring mvc uses an independent AOP method . As a result, the amount of configuration files of struts is still larger than that of spring mvc, although the configuration of struts can be inherited, so I think that in terms of use, spring mvc is more concise.

 

Guess you like

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