views:

560

answers:

4

Hi. Wanna ask which is better to use. Struts or spring. What are its edges over the other and the difference on their flow or how they work.

+1  A: 

Struts and Spring are two different things, one is not a complete replacement for the other.

Struts is a web application framework. Spring is much more than that; there's a (small) part of Spring called Spring Web MVC which is a web app framework comparable to Struts.

Jesper
+7  A: 

Apache Struts is an open-source web application framework for developing Java EE web applications. It uses and extends the Java Servlet API to encourage developers to adopt a model-view-controller (MVC) architecture.

On the other hand The Spring Framework is much more than that. It comprises several modules that provide a range of services

  • Inversion of Control container
  • Aspect-oriented programming
  • Transaction management
  • Model-view-controller helpers (this is small part that is somehow comparable with Struts)
  • .. and lots of others.

So I think it is just comparing apples to oranges.

But for just comparing Spring MVC and Struts itself this link could help. I think better is to close this question and ask more specific (something like: which MVC Java framework is the best?)

All quotations from Wikipedia

Michal Sznajder
I am currently investigating on the two which is best to use as a framework for our coming project. Maybe the wider scope of support for complex web applications the better.
cedric
+1  A: 

Struts is basically a request based framework while spring is a component based framework. All the benefits of struts can be achieved through spring (Spring MVC). Spring has many modules which helps you develop enterprise application with different components like ORM, AOP, MVC, Transaction management etc., With Spring 3.0 it has an inbuilt support for restful services too. Also spring portfolio has other projects which seamlessly integrates with spring like spring security(Acegi security), osgi, Spring web services and all.. Over all spring offers more benefits than struts in developing a quality applications by enforcing good design and decoupled components

Teja Kantamneni
A: 

Comparing instead of contrasting, they're both probably worth learning, Struts first, then Spring.

Given a choice of one, Spring MVC, as you can then start using the rest of Spring piecemeal.

To the downvoter who commented, much appreciated:

Struts is dirt simple; Struts 1.0 was written in a day. It gives you a feel for using a framework, and it trivial to use. I think it's worth learning then scrapping, just so you have the experience, but I didn't make that clear by any means in my original answer.

To the downvoter that, you know, couldn't be bothered to comment, what the heck?

Dean J
Unless you are unlucky enough to be dumped with maintaining some Struts project, don't waste your time on it.
hbunny