This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes get datasource outside action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "get datasource outside action class" Watch "get datasource outside action class" New topic
Author

get datasource outside action class

roseline ruba
Greenhorn

Joined: Mar 21, 2007
Posts: 20
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.


Roseline
Craig Bayley
Ranch Hand

Joined: Sep 27, 2007
Posts: 46
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">
 
GeeCON Prague 2014
 
subject: get datasource outside action class