• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring in the business layer

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

is this design possible?

Struts(Web tier) + Spring(Business layer) + Hibernate(Persistence layer)

Thanks in advance,

Angel
 
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In short, yes.

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.
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Angel Hafer:

Struts(Web tier) + Spring(Business layer) + Hibernate(Persistence layer)
Angel



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
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so, Struts + Spring + Hibernate is not good combination? I have been reading about them a lot.

This scares me.
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fear not. It's perfectly okay to use Spring with Struts and Hibernate.
 
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic