• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

struts vs spring framework

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
anyone please explain me what is the exact difference between struts and spring framework.Which one have advantage?
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Depends on what you want to do. Just keep in mind Struts does not equal Spring.
Struts is just a front end framework. Spring covers the whole deal!
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which one is better? and in which condition we will prefer one over another?
[ December 06, 2005: Message edited by: Hemant Agarwal ]
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


Sachin Gupta
Software Engineer
SunGard Data System india
[email protected]
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sachin,
There is a default support of IoC & AOP in Spring
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have Hibernate I prefer Hibernate for the jdbc ...
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

We have Hibernate I prefer Hibernate for the jdbc ...



I dont think it is related to Sprint in anyway, since it can layer on top of hibernate and on top of many other Persistent mechanism driven products ...

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.



for me I consider this a disadvantage.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I will go through some basic differences.

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.

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i think everybody is comparing struts1 with spring. We should compare struts2 with spring. then find out which one is better.

please do a compare of struts2 and spring2.5 and then see which one is better.

regards
Sunil
 
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any update please?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Struts will be Generally used as a Front End Frame work.
Spring has spring webFlow for the same purpose, which is part of spring Framework.

The other major advatages of spring Framework is it handles

- Transaction management
- support for Messaging
- support and Integration with Other Frame works.
(Eg: Hibernate, Struts, Tapestry.. etc)

Struts Framework have some advantages
-Excellent support for Tag Library, which has wide industry acceptance.
-Easy to integare with other client side technologies.

It really a subjective matter, what for you want to use them.
both can be combindly used, to take best out of them,
or spring can alone can be used.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by abburi:

both can be combindly used, to take best out of them,



Yes. I prefer to use both frameworks, Struts 2 for the front end and Spring for DB access.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hemant Agarwal wrote:Which one is better? and in which condition we will prefer one over another?
[ December 06, 2005: Message edited by: Hemant Agarwal ]

 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@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.
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohana Rao wrote:@Naveen .



Naveen posted that in 2008 and hasn't posted since. I don't think he's going to respond
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't checked the time , All I can say more or less spring MVC = Struts 2.0.
 
Ranch Hand
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

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.

 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

debraj mallick wrote:
please check out struts2



The post you quoted is from February 2006. Struts 2.0 was announced in October 2006, so at the time his statements were more accurate (though still to be taken with a grain of salt)
 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't compare Struts2 with Spring. I guess you mean Struts2 vs. Spring MVC.
In both Frameworks you have an excellent support for Spring as DI and Spring/Hibernate for DB Access.

I prefer Struts2 because it is relly flexible and extendible with Plugins.

1.) Convention Plugin
No more XML Hell!

2.) REST Plugin
Support for REST based URLs and Applications

3.) Getter/Setter for Parameter

4.) jQuery Plugin :-)

5.) JSON Plugin

Johannes

 
Greenhorn
Posts: 4
Android MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So how can you tell that this framework is tightly/loosely coupled?
What are the steps that you would go through to examine it?
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

[Edited for language]

 
Die Fledermaus does not fear such a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic