Sunday, February 2, 2014

Difference between Spring and Struts framework:

The major differences between Spring framework and Struts framework are :

Spring is an application framework in which Spring MVC is one of the modules of Spring framework.
Struts is a web framework which can be used to develop web applications.
Spring implements IOC Design Pattern.
Struts implement MVC Design Pattern.
It provides abstraction layer on multiple Java/J2EE technologies including Servlet, JSPs. Also provides abstraction on other framework software.
It provides abstraction layer only on Servlet, JSP technology.
Spring is a Layered Architecture.
Struts is a not a Layered Architecture.
Spring Framework is said to be a non-invasive means it doesn’t force a programmer to extend or implement their class from any predefined class or interface given by Spring API.
Struts is said to be invasive. In Struts we used to extend Action Class.
It forces the programmer that, the programmer class must extend from the base class provided by Struts API.
Spring provides easy integration with ORM, JDBC technologies.
In Struts, integrating with ORM,

JDBC technology, we need to do manually coding.
Gives built-in middleware services like transaction, logging, connection pooling etc.
Doesn’t give built-in middleware

Spring is Lightweight framework.
Struts is Heavyweight framework.
Spring is loosely coupled.
Struts is tightly coupled.
It is not easy to integrate with other client side technologies.
It is easy to integrate with other  

client side technologies.
Spring MVC just provides tags for basic HTML form tags.
Struts 2 provides many out-of-box JSF styled complex and composite tags
Such as: Ajax DOJO tags
For View component, Spring allows JSP, Velocity, Freemarker, Excel and PDF
For View component Struts allows only JSP.
Spring MVC provides more handler mappings.
Struts doesn’t have specific handler
mappings but uses Action mappings.
Spring clear module division between Model, View and Controller.
Struts mixes Controller and Model.
Advantages of Spring Framework:

  • Transaction management
  • Support for Messaging
  • Support and Integration with Other Frameworks (Eg: Hibernate, Struts, Tapestry.. etc)
Advantages of Struts Framework:

  • Excellent support for Tag Library, which has wide industry acceptance.
  • Easy to integrate with other client side technologies.