Compare Spring MVC and Struts MVC

Spring framework tutorial | Spring framework tutorial pdf downloads

1. There is clear separation between models, views and controllers in Spring.
2. Spring’s MVC is very versatile and flexible based on interfaces but Struts forces Actions and Form object into concrete inheritance.
3. Spring provides both interceptors and controllers, thus helps to factor out common behavior to the handling of many requests.
4. Spring can be configured with different view technologies like Freemarker, JSP, Tiles, Velocity, XLST etc. and also you can create your own custom view mechanism by implementing Spring View interface.
5. In Spring MVC Controllers can be configured using DI (IOC) that makes its testing and integration easy.
6. Web tier of Spring MVC is easy to test than Struts web tier, because of the avoidance of forced concrete inheritance and explicit dependence of controllers on the dispatcher servlet.
7. Spring web layer built on top of a business object layer which is considered a good practice. In Struts framework you need to implement your business objects .
8. Struts forces your Controllers to extend a Struts class but Spring doesn’t, there are many convenience Controller implementations that you can choose to extend.
9. In struts a variety of Struts specific tags are used to assure that request parameters are bound to ActionForm fields and show binding/validation errors. In SpringMVC, there is one simple bind tag that handles all of this. Your JSP’s remain smaller and have more pure HTML content.
10. In Struts, Actions are coupled to the view by defining ActionForwards within a ActionMapping or globally. SpringMVC has HandlerMapping interface to support this functionality.
11. With Struts, validation is usually performed (implemented) in the validate method of an ActionForm. In SpringMVC, validators are business objects that are NOT dependent on the Servlet API which makes these validators to be reused in your business logic before persisting a domain object to a database.