java 2 Answer(s) 6 years and 4 months ago
Posted in : Framework
August 12, 2008 at 1:41 PM
Difference between struts and springs.
Struts is a sophisticated framework offering the easy 2 develops, structured view and presentation layer of the MVC applications. Infacr Struts can be used as the presentation tier ins spring
Springs features strictly associate with presentation stuff. It offers Tiles to bring in reuse at presentation level. It offers Modules allowing the application presentation to segregate into various modules giving more modularity there by allowing each module to have its own Custom/Default Request Processor. Spring provides Aspect Oriented programming, it also solves the seperation of concerns at a much bigger level. It allows the programmer to add the features (transactions, security, database connectivity components, logging components) etc., at the declaration level. Spring framework takes the responsibility of supplying the input parameters required for the method contracts at runtime reducing the coupling between various modules by a method called dependency injection / Inversion of Control.
Struts is developed with a Front Controller and dispatcher pattern. Where in all the requests go to the ActionServlet thereby routed to the module specific Request Processor which then loads the associated Form Beans, perform validations and then handovers the control to the appropriate Action class with the help of the action mapping specified in Struts-config.xml file. On the other hand, spring does not route the request in a specific way like this, rather it allows to you to design in your own way however in allowing to exploit the power of framework, it allows you to use the Aspect Oriented Programming and Inversion of Control in a great way with great deal of declarative programming with the XML. Commons framework can be integrated to leverage the validation in spring framework too. Morethan this, it provides all features like JDBC connectivity, OR Mapping etc., just to develop & run your applications on the top of this.
Struts 2 is one of the best framework for developing the enterprise applications. Struts is popular framework among the developers. Struts was first released in the year 2001. Since then it was being used by developers to develop complex application. Now struts 2 is released which even more powerful. So, Struts is the best tool to develop web applications. You can use spring framework along with the struts.
Spring framework is glue to integrate all the frameworks that present today. Spring provides many features. You can use spring with your struts application.
My advice is to use Struts 2 and Spring framework in your application.