This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Accessing data source inside Action servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Accessing data source inside Action servlet" Watch "Accessing data source inside Action servlet" New topic
Author

Accessing data source inside Action servlet

Tad Dicks
Ranch Hand

Joined: Nov 16, 2004
Posts: 264
Ok I've extended the ActionServlet for a web app so I could initialize values in the servletContext from the database. How can I access the datasources that are set up in the struts-config?
I've found a method which seems to be depracated (and didn't work): getDataSource(String name);
and then I found a member called dataSources which is a "fastHashMap"
And I'm not quite sure how to get the dataSource from it. I'm only using one data source so its not "keyed".


-Tad
 
 
subject: Accessing data source inside Action servlet
 
Similar Threads
Readin struts-config.xml from Action
Loading application scope variables on startup.
How to make a data source connection without writing a User name & Password and the -ds.xml file
dynamically lookup datasources from stateless sessin bean
JasperReports and databases