Wednesday, February 9, 2011

Struts Vs Spring

Struts

It is an open source web application framework. It is used to design large scale applications promoting Model-View-Controller architecture. Framework consists of set of custom tag libraries that helps to build dynamic web applications.



Container first look for the web.xml file to determine what struts action servlets exists are. The container is responsible for mapping all the file request to the correct action Servlet. When a user made a request through a submitting a form then controller determines what action to be performed. Then it sends the relevant information to process using a action bean. Most of the struts applications have only one controller named ActionServlet. The key advantage of having a controller is its ability to control the flow of logic through the highly controlled, centralized points.

The one more responsibility of the controller is to check the struts.config.xml file to determine which module to be called upon an action request. Struts.config.xml file is a configuration file which stores mapping of actions.

Then data is processed in model. Struts provide the ActionForm and the Action classes which can be extended to create the model objects. After processed then data is passed to view. The view in struts framework is mainly a jsp page which is responsible for producing the output to the user.
Struts tag libraries are struts components helps us to integrate the struts framework within the project's logic. These struts tag libraries are used within the JSP page. This means that the controller and the model part can't make use of the tag library but instead use the struts class library for strut process control. Then the output is viewed to the user.

Spring

Spring is an open source application framework. It consists of modules such as MVC architecture, data access, transaction management, authentication and authorization, messaging testing and may more. The below diagram shows the seven major modules in spring framework.


Spring AOP -     To provide declarative enterprise services (declarative transaction management), To allow users to implement custom aspects, complementing their use of OOP with AOP
Spring ORM - The ORM package is related to the database access.
Spring Web - The Spring Web module is part of Spring’s web application development stack, which includes Spring MVC.
Spring DAO - support in Spring is primarily for standardizing the data access work using the technologies like JDBC, Hibernate or JDO.
Spring Web MVC -  This is the Module which provides the MVC implementations for the web applications.


Difference between Struts and Spring


refer : http://www.roseindia.net

4 comments: