When we talk about MVC frameworks Struts(original and not Struts2) is the first framework that comes to mind, not only its because has been the pioneers in this space, but its one of best frameworks till today. With the advent of Spring MVC, the possible short coming of Struts framework very take care by Spring MVC . The following are Spring MVC advantages over Struts:<!>
- Spring provides a very clean division between controllers, JavaBean models, and views.
- Spring’s MVC is very flexible. Unlike Struts, which forces your Action and Form objects into concrete inheritance (thus taking away your single shot at concrete inheritance in Java), Spring MVC is entirely based on interfaces. Furthermore, just about every part of the Spring MVC framework is configurable via plugging in your own interface. Of course we also provide convenience classes as an implementation option.
- Spring, like WebWork, provides interceptors as well as controllers, making it easy to factor out behavior common to the handling of many requests.
- Spring MVC is truly view-agnostic. You don’t get pushed to use JSP if you don’t want to; you can use Velocity, XLST or other view technologies. If you want to use a custom view mechanism – for example, your own templating language – you can easily implement the Spring View interface to integrate it.
- Spring Controllers are configured via IoC like any other objects. This makes them easy to test, and beautifully integrated with other objects managed by Spring.
- Spring MVC web tiers are typically easier to test than Struts web tiers, due to the avoidance of forced concrete inheritance and explicit dependence of controllers on the dispatcher servlet.
- The web tier becomes a thin layer on top of a business object layer. This encourages good practice. Struts and other dedicated web frameworks leave you on your own in implementing your business objects; Spring provides an integrated framework for all tiers of your application.
- In Struts, validation is usually implemented in the validate method of an ActionForm, sometimes using the Jakarta common-validator package for declarative validation definition. In SpringMVC, validators are first class business objects that are NOT dependent on the Servlet API, even when using commons-validator (there is code in the sandbox to support this). This allows these validators to be reused for instance in your business logic before persisting a domain object to a database.
* Sturts 2 is the revision of Struts (original) and takes care of such shortcoming and provides a good set of competing features.[pb_builder]