aspose file tools*
The moose likes Struts and the fly likes struts vs spring framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts vs spring framework" Watch "struts vs spring framework" New topic
Author

struts vs spring framework

arun prassath
Greenhorn

Joined: Dec 05, 2005
Posts: 1
anyone please explain me what is the exact difference between struts and spring framework.Which one have advantage?
Ergin Er
Ranch Hand

Joined: Sep 06, 2005
Posts: 60
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!
Hemant Agarwal
Ranch Hand

Joined: Nov 21, 2005
Posts: 138
Which one is better? and in which condition we will prefer one over another?
[ December 06, 2005: Message edited by: Hemant Agarwal ]
Sachingupta Gupta
Greenhorn

Joined: Aug 18, 2005
Posts: 3
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
sachin.gupta@sungard.com


Sachin Gupta<br />Software Engineer,<br />SunGard Data System India Pvt. Ltd. Pune<br />sachin.gupta15@gmail.com
Shrinivas Mujumdar
Ranch Hand

Joined: Aug 27, 2004
Posts: 328
Sachin,
There is a default support of IoC & AOP in Spring
dnyan ginde
Ranch Hand

Joined: Jan 17, 2006
Posts: 68
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 ]
ss kumar
Greenhorn

Joined: Jan 14, 2004
Posts: 19
We have Hibernate I prefer Hibernate for the jdbc ...


Thanks,<br />Shoban Sriram
levani dvalishvili
Ranch Hand

Joined: Mar 01, 2005
Posts: 99
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.


SCJP 1.5(Done) SCJA 1.0(Done)<br />SCWCD(in Progress...)
Naveen Yannam
Greenhorn

Joined: May 12, 2008
Posts: 1
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.



Naveen Reddy Yannam<br />Tech Mahindra
sunil gupta
Greenhorn

Joined: May 07, 2008
Posts: 21
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
pradeep singh
Ranch Hand

Joined: Oct 23, 2007
Posts: 339
Any update please?


SCJP 5.0(75%), SCWCD 5.0(88%)
abburi
Greenhorn

Joined: Nov 13, 2008
Posts: 1
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.
Veera Sundar
Greenhorn

Joined: Jun 08, 2007
Posts: 25
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.


Thanks,<br />Veera |<a href="http://veerasundar.com/blog" target="_blank" rel="nofollow">Blog</a>
sivakumar murugesan
Greenhorn

Joined: Sep 26, 2011
Posts: 1
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 ]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8908
    
    8

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

@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.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8908
    
    8

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

Joined: Aug 01, 2007
Posts: 485

I haven't checked the time , All I can say more or less spring MVC = Struts 2.0.
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

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

Joined: Oct 29, 2001
Posts: 8908
    
    8

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)
Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
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


My Java and Webprogramming Blog
Ghazi Hudeihed
Greenhorn

Joined: Sep 11, 2011
Posts: 4

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

Joined: Oct 29, 2001
Posts: 8908
    
    8

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.
Rees Byars
Greenhorn

Joined: Feb 13, 2012
Posts: 12
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]

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts vs spring framework