Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Spring vs Struts

Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?

author & internet detective
Posts: 40035
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • 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.
Posts: 9615
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • 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
Eclipse IDE PHP Java
  • Mark post as helpful
  • send pies
  • 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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic