Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get datasource outside action class

 
roseline ruba
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there any option to get the datasource connection from the non-action class?, where the datasource specified in the struts-config.xml file.
 
Craig Bayley
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the class shares the same InitialContext as the action class, then yes, no worries. You can just get the reference that way:

The <resource reference> corresponds to the context.xml entry (or server.xml entry)
<ResourceParams name="<resource reference">
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic