To know the difference between Struts and Spring, we must first explain and understand both the frameworks a little.
Spring framework is a Java platform that is used to develop modular, portable and testable Java applications. It is an open source framework that is used extensively to develop applications. Spring is so popular that it is referred as de-facto standard for developing Enterprise Java applications.
Spring handles the infrastructure, allowing developers to create high performing, easily testable and reusable code and application. It is also used to build web applications on top of the J2EE platform.
Spring works on Dependency Injection concept aka Inversion of Control (IoC) component and Aspect Oriented Container Framework. It supplies input parameters at runtime that reduces the coupling between various modules.
Spring provides a framework to integrate OR mapping, JDBC etc.
Apache Struts framework
Struts is a cross-platform framework that promotes MVC architecture i.e. Model, View and Controller. It is an open source framework that is now extensively used to develop Java EE web applications.
Its current stable release is version 126.96.36.199.
Struts is a request-based framework, which means that it receives a request from the user, carries out the required task and then sends back the result. For this it has a request handler, a response handler, and a tag library.
Struts support REST applications and various technologies like SOAP, AJAX, etc.
All the requests are mapped by Controller to a specific action. Action mapping is specified in Struts-config.xml file. It than creates an instance of this action and invoke interceptors. Interceptor are invoked before and after the action is executed.
Model contains the data and the business logic and is implemented by the Action component.
View displays the result.
|Light weight||Heavy weight|
|does not supports tag Library||supports tag Library|
|loosely coupled||tightly coupled|
|provides easy integration with ORM technologies||Manual Coding|
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: Difference between Struts and Spring
Post your Comment