• 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

Dependency Injection in struts 2.0

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone tell me where exactly the dependency injection comes into picture in struts 2.0?

Thanks.
 
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Dependency injection in Struts action classes can be used to inject dependencies such as business delegates and other helper classes.
Even you can inject some configuration properties as well in the Struts action classes.
There three ways to achieve this
1) Using Spring Action Support classes.
2) Using DelegatingRequestProcessor
3) Using DelegatingActionProxy = I have used this one earlier in one of the projects. This is the best way suggested to use DI in struts. In this approach you declare map the type attribute in action-mappings to the spring class DelegatingActionProxy and declare the action class as spring beans in spring configuration file.
Thnx
amit
 
Vineela Devi
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am a bit confused with the explanations of the Dependency Injection. Can anyone please explain the IOC or dependency Injection concept with an example or point me to some good links where I can get a clear picture of the same and how it's used in the struts 2.0 framework(probably with some live examples).

Thanks Much!
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you don't understand the concept of IOC very well, my advice would be to forget about Struts 2 for a while and concentrate on learning IOC in the context of Spring. Then once you have a good handle on that, work on how to integrate with Struts 2.
[ June 21, 2007: Message edited by: Merrill Higginson ]
 
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic