This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer (Exam 1Z0-830) Java SE 17 Developer (Exam 1Z0-829) Programmer’s Guide and have Khalid Mughal and Vasily Strelnikov on-line!
See this thread for details.
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Spring vs Struts

 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,

Just really curious when one would use Spring Framework (Spring MVC, Spring Web) over Struts. Struts and Spring almost have the same features and advantages but I just wanna know what are the main reasons that would really make you say "well in this case, using Spring is a better choice".

Does it really boil down on the preference of developers these days? I mean like using Struts or Spring because it is the technology direction of the client or company....and really no design based reasons in choosing when to use these frameworks?

thanks
 
author & internet detective
Posts: 42135
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Struts 1 has end of lifed so I assume you are talking about Spring vs Struts 2.

Struts 1 was very popular. Struts 2 is a completely different framework that happens to have the same name. There are other MVC frameworks as well. If you are using Spring for your middle/back tiers, Spring MVC makes sense to choose because the integration is very clean. Beyond that, it is mostly developer/company preference.
 
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
Struts is intended to be an implementation of the Front Controller Pattern, thought there is a little more to it than that. Spring brings a lot more features to the table. For example, it makes it easy to "inject" a feature across an entire application. For example, say you needed to send out a log message before every DAO call. If your application were properly designed, Spring can do that. This ability to inject code also comes in handy with testing. Some developers also like to move the logic of the application out of the code and into the configuration. This is useful if you have an application that has a bunch of logical elements that are reused in different combinations and sequences. Spring makes it easy to do that. Spring also has its own security model, so if you aren't happy with the standard JEE security you have the option to use it.
That said, you can always use Spring with Struts 2, and in fact, it has a plugin to make Spring integration easy bundled with the distribution.
Rather than "developer preference", I would say you should look at the requirements of your application and see what framework (and there are many) best facilitate your building your application.
 
Ranch Hand
Posts: 116
2
Eclipse IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Andres,

Here is a webinar put on by the Virtual Java User Group a few weeks ago. It compares various Java web frameworks including but not limited to Spring and Struts. Most reviews have some bias but as long as you focus on the facts, there is still some good information in here.

It should at least give you a good idea of what frameworks are available and in general what their strengths and weaknesses are.

Comparing Java Web Frameworks

Hope this helps.
reply
    Bookmark Topic Watch Topic
  • New Topic