12 BENEFITS of Spring MVC over Struts

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

1. Spring provides a very clean division between controllers, JavaBean models, and views.

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

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

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

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

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

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

8. No ActionForms. Bind directly to domain objects

9. More testable code (validation has no dependency on Servlet API)

10. Struts imposes dependencies on your Controllers (they must extend a Struts class), Spring doesn’t force you to do this although there are convenience Controller implementations that you can choose to extend.

11. Spring has a well defined interface to business layer

12. Spring offers better integration with view technologies other than JSP (Velocity / XSLT / FreeMarker / XL etc.)

Reference: Here

Advertisements

44 Replies to “12 BENEFITS of Spring MVC over Struts”

  1. Nice post about Spring vs Struts Lijin

    More advantages include

    * Spring provides a fine separation of specification for JMS 1.0 and 1.1
    * It provides us the flexible url grouping and redirection using *-servlet.xml.
    *Ensures the dependancy of beans over each other at the time of deployment with help of DependencyInjection
    * Several other features of Autowiring, built in Hibernate Template, portlet framework and WebService integration makes Spring the best ever application MVC framework

    Check for more related posts and examples @ Stark Solutions

  2. I found the title of this article very interesting but was disappointed to see points being repeated and hence not adding any value.

    A cut short answer to 12 points (ignoring some duplicate points) is “please refer struts 2”. Probably all of this can also be achieved very easily in struts 2

  3. Cheap levitra works in much the same way as Sildenafil Citrate, but is much faster, lasting up to 36 hours vaiagra generic .. For viagra drug fast delivery Canada! No prescription required-buy sexual activity pill ! Easy to get levitra pills online.. Find out more about sexual activity at the great cialas levitra site…

  4. Сейчас кроме нашей основной деятельности не стоит забывать о регулярной антикризисной медитации

  5. Viagra works in much the same way as Sildenafil Citrate, but is much faster, lasting up to 36 hours cialias generic drugs ! For viagra order online generic very fast delivery worldwide… Save your money – buy cheap cialis pill ! Easy to get cheap levitra pills online… Find out more about cheap cialis at the great ciallis pill site!

  6. Cheap levitra is taken orally and helps men suffering from erectile dysfunction achieve and maintain an erection cialias cream women ! For cialis discount online very fast delivery for you… Save your time buy cheap viagra tabs online… Fast to get levitra pills online.. Find out more about ed treatment at the official viagera soft tabs site.

  7. Hi Henry,

    You can easily get all the Struts 2.0 beans in Spring Application context. Get that beans and use the Dependency injuction perfectly. Done! Hope this helps…

    Lijin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s