views:

101

answers:

3

How do Struts and Spring differ, and which one is more appropriate for developing a web application?

+4  A: 

Spring is much more than Struts. Web MVC is just a small subset of the capabilities that Spring provides.

Struts is one of the first web MVC frameworks based on servlets and JSPs

Spring is a Java EE application framework based on Inversion of Control (IoC) and aspect-oriented programming (AOP).

Spring has a web MVC module that's analogous to Struts. I'd argue that it improves on Struts. Spring can also use Struts as its web MVC module if you'd like.

duffymo
thanks for your nice difference.
EswaraMoorthyNEC
A: 

I would suggest you use Spring MVC + Spring IOC and whatever else Spring you use. If you aren't familiar with Spring, it is a good thing to learn.

bwawok
+1  A: 

Struts and Spring cannot be compared. It's comparing apples with oranges. Comparing Spring MVC with Struts makes more sense. Spring is an application framework based on IOC, Spring MVC is one of its several add-ons.

Struts is a framework of past and should be used only if you are dealing with some legacy code. But if you are building a new application from scratch, I would highly recommend using Spring MVC. Its far more flexible than Struts. The only trade-off in using Spring MVC is that you will first have to learn Spring framework and the concepts it is based upon (Inversion Of Control, Dependency Injection etc). But it's worth spending time and pays you back in the long run.

craftsman