I am confused. some articles say that Spring is similar to struts and is here to replace struts in web tier. and few say that Spring can be used in business tier with struts in web tier. Which is true? Can I use Spring in place of EJB's in business layer?
Spring has several components that can be used with other Spring components, with other frameworks, or standalone. If you use Hibernate as your backend Spring can deal with transaction managment for you, and there are other benefits, but I'm not really an expert here. Once you have that you can use JSP, JSF, Sevlets, Struts, Spring, Tapestry, ect... for the frontend.
I believe you can also use Spring with JDO, EJB's, and some other persistence layers, as well as standalone, on the backend.
Spring was designed to be very flexible and modular.
Yes sir, in addition to that you can use Spring as an AOP Framework. You can use it as your ORM or it can work with other ORM like Hibernate. You can also use it in building your web layer and for your view layer as an alternative to Struts or you can use it to work with Struts. You can also use it in managing your transaction that can work with different platform like JTA, Hibernate, JDBC and etc.
You can use it as your ORM or it can work with other ORM like Hibernate.
Not to be picky, but... Spring does not have its own ORM framework. It provides a framework that makes it much easier to work with JDBC, as well as integration with several ORM tools, such as Hibernate, JDO, iBATIS and OJB.
You can use it as your ORM or it can work with other ORM like Hibernate. You can also use it in building your web layer and for your view layer as an alternative to Struts or you can use it to work with Struts.
Just to be clear, Spring does not provide its own view technology. It does integrate with other view technologies like JSP, Tapestry and Velocity. It also provides Spring tags for easier integration.
I think in this discussion definitions of view technology and MVC framework are mixed. If I understand correctly, Struts doesn't offer a genuine view technology neither. You use a view technology like jsp, jsf, tapestry or velocity in a MVC framework to tell the browser how to render a view. And you know that. Its just a definitions overflow. [ April 30, 2005: Message edited by: Axel Janssen ]
Joined: Aug 07, 2003
You're right, of course. For the past several years I've been using Struts with an in-house XML + XSL -> HTML view layer. I'm pretty burnt out and it didn't even occur to me that Struts doesn't have its own view technology. Thanks for the correction.
So I guess Spring MVC is equivalent to Struts as far as the roles they play.
Originally posted by James Carman: Fear not. It's perfectly okay to use Spring with Struts and Hibernate.
Sure, Struts/Spring/Hibernate is a fine way to develop an application. I think the reason some people dismiss this combination is that Struts 1.x (as we know it) is a dead/sick/dying project. There's nothing wrong with it, but there are better options available nowadays.
My favorite stack is Tapestry/Spring/Hibernate, but I also see some merit in JSF/Spring/Hibernate. I've also developed several apps using SpringMVC/Spring/Hibernate. To each his own.