i am writing some diffrences between Spring and Struts 1. Struts is a web framework only, Struts can be compare with the SpringMVC. And SpringMVC is subset of the Spring framework. So we can say that Sturts can be seen as the subset of the spring framework in functionality point of view. 2. What Action class do in struts, Controller does in Spring. And action in Struts is a Abstract class but Controller in Spring is an interface, This is very good advantage of the spring. 3. Spring don�t have any action from, it bind the http form values directly into pojo. Instead of initializing the form bean spring directly initialize the domain object. 4. ActionForward in struts is replace with the ModelAndView in Spring. Model component contain the business object to be displayed via view component. 5. Unlike Struts Spring don�t provide any separate tag library.
Spring has excellent support classes for jdbc. Classes like MappingSqlQuery, SqlUpdate, StoredProcedure help you manage the selects,inserts and stored procedures. With Spring you need not even have try, catch and finally in your jdbc code. Spring handles opening, transaction management and closing of connections. When it comes to designing your application i would say that integrating struts with Spring gives you quite a few options. Struts for the view and control, Spring for the jdbc part. [ February 24, 2006: Message edited by: dnyan ginde ]
1.Struts implement MVC Design Patten where as Spring implements IOC Design Pattren and addreses AOP Cross cutting concerns. 2.Struts is heavy weight where as Spring is light weight framework. 3.Struts is tightly coupled Spring is loosely coupled.
Welcome to the JavaRanch, sivakumar. The "best" framework is the one that fits the requirements for your application. There is no substitute for researching the features, prototyping and evaluating the various frameworks and determining if they will work for your purposes.
@Naveen Struts is heavy weight where as Spring is light weight framework. Show me proof
Struts is tightly coupled Spring is loosely coupled. - invalid statement struts 2 is loosely coupled.
ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
which framework is great? it does not matter, it depends upon your requirement of the application. both Struts2 and spring3 have excellent documentation.
Struts2 have excellent jQuery tag library, so what for DI we need spring to integrate with struts, spring also have tag lib but not as struts2,
to me, before choosing any framework all we need to do is to analyse the requirement.
3. Spring don�t have any action from, it bind the http form values directly into pojo. Instead of initializing the form bean spring directly initialize the domain object.
please check out struts2. we don't need action form like strut1, in strut2 the getter n setter in action is serialized which is very much usefull to retrieve json data.
if you need to use hibernate, struts2 have plugin for that,
2.Struts is heavy weight where as Spring is light weight framework.
rubbish, please guys do not take this type of comments serious. it is alway better to go thru the documentation.
Ghazi Hudeihed wrote:So how can you tell that this framework is tightly/loosely coupled?
I would consider a framework "tightly coupled" if you have to write a lot of code to interface with it. Struts 1, with its FormBeans and actions that must extend org.apache.struts.action.Action, is tightly coupled in my mind.
Struts 2, with the ability to use POJO's as actions and form beans would be less tightly coupled than Struts 2. You still have to account for the framework, for example the action method has to return a string that is mapped in the struts config file, so there is still some coupling necessary.
Struts2 tightly coupled? If anything, its Spring MVC that is tightly coupled. Struts2 works with Spring, Guice, CDI, and by itself. Spring MVC works ONLY with Spring, and cannot work without it. Now that is some tight coupling.