top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Spring: What is advantages of Spring MVC over Struts MVC?

+2 votes
673 views
Spring: What is advantages of Spring MVC over Struts MVC?
posted Feb 9, 2015 by Kali Mishra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

Here I am trying to give some key advantage Please have a look once:

  1. Spring's MVC is very versatile and flexible based on interfaces but Struts forces Actions and Form object into concrete inheritance.

  2. Spring provides both interceptors and controllers, thus helps to factor out common behavior to the handling of many requests.

  3. 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.

  4. In Spring MVC Controllers can be configured using DI (IOC) that makes its testing and integration easy.

  5. 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.

  6. Struts force your Controllers to extend a Struts class but Spring doesn't, there are many convenience Controller implementations that you can choose to extend.

  7. In Struts, Actions are coupled to the view by defining ActionForwards within a ActionMapping or globally. SpringMVC has HandlerMapping interface to support this functionality.

  8. 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.

answer Feb 9, 2015 by Amit Kumar Pandey
useful.. thanks for sharing
0 votes

SPRING:

Spring is a powerful Java application framework, used in a wide range of Java applications. It provides enterprise services to Plain Old Java Objects (POJOs). Spring uses dependency injection to achieve simplification and increase test ability.

ADVANTAGES OF SPRING MVC OVER STRUCT

1. There is clear separation between models, views and controllers in Spring.

2.  Spring, like WebWork, provides interceptors as well as controllers, making it easy to factor out behavior 
    common to the handling of many requests.

3. In Struts, Actions are coupled to the view by defining ActionForwards within a ActionMapping or globally. 
   SpringMVC has HandlerMapping interface to support this functionality.

4.   No ActionForms. Bind directly to domain objects

5. More testable code (validation has no dependency on Servlet API)
answer Feb 13, 2015 by Karthick.c
...