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 Retrieving datasource from init(ActionServlet, ModuleConfig) 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 "Retrieving datasource from init(ActionServlet, ModuleConfig)" Watch "Retrieving datasource from init(ActionServlet, ModuleConfig)" New topic
Author

Retrieving datasource from init(ActionServlet, ModuleConfig)

Jesus Fernandez
Greenhorn

Joined: Aug 11, 2003
Posts: 14
Hi all, how can i obtain a datasource from de init(ActionServlet, ModuleConfig) methos inside a class that implements Plugin
Here is the code:


Thanks in advance
Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
It is generally considered bad design to use the Struts datasource feature since it introduces a dependency between your controller (struts) and your model. Instead use your JNDI, follow this link:

http://www.coderanch.com/t/51774/Struts/struts-database-connection


http://www.goodercode.com
SCJP 1.4
Jesus Fernandez
Greenhorn

Joined: Aug 11, 2003
Posts: 14
Thanks for the reply Kerry.
But my goal is obtain a DataSource when my application startup ro retrieve some data from a BD. That's why i need the DataSource. My question is how can i obtain this one from the init method of a class that implements Plugin and execute both the init(..) and destroy() methods
Thanks in advance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retrieving datasource from init(ActionServlet, ModuleConfig)
 
Similar Threads
Session exists even before we have logged in
Plugin init method is not called
why BasicDatasource not find by compiler? even i added commons.dbcp.jar in project /webroot/lib
Get rid of line numbers
Struts framework question.. thanks..