This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
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.
arnel nicolas
Ranch Hand
Joined: Dec 16, 2003
Posts: 149
posted
0
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.
Ryan Breidenbach
author
Greenhorn
Joined: Jan 06, 2004
Posts: 18
posted
0
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.
David Harkness
Ranch Hand
Joined: Aug 07, 2003
Posts: 1646
posted
0
Originally posted by Ryan Breidenbach: Spring does not provide its own view technology.
I thought Spring MVC was a complete web framework. If not, is it merely missing the presentation layer (view in MVC) for which you can use any number of templating libraries?
Rod covered it only briefly in his book Professional Development Without Drinking the Kool-Aid -- er, I mean Without EJB -- but I was under the impression it was complete on its own.
Axel Janssen
Ranch Hand
Joined: Jan 08, 2001
Posts: 2164
posted
0
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 ]
David Harkness
Ranch Hand
Joined: Aug 07, 2003
Posts: 1646
posted
0
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.
My project is using this model. But i think it is not the best. Now i am studying jsf. Maybe jsp+spring+hibernate is better.
Padma Prasad
Ranch Hand
Joined: Sep 16, 2002
Posts: 76
posted
0
so, Struts + Spring + Hibernate is not good combination? I have been reading about them a lot.
This scares me.
James Carman
Ranch Hand
Joined: Feb 20, 2001
Posts: 580
posted
0
Fear not. It's perfectly okay to use Spring with Struts and Hibernate.
James Carman, President<br />Carman Consulting, Inc.
Craig Walls
author
Ranch Hand
Joined: Sep 19, 2003
Posts: 301
posted
0
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.
Spring in Action - Unleash POJO power in your applications!
Modular Java - Discover the secret weapon to modularity on the Java platform!
XDoclet in Action - Your complete guide to code generation with XDoclet.