You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thibaut Lassalle <tl...@cvdunet.com> on 2005/06/01 16:05:20 UTC

access to dataSource configured in struts-config.xml in a Plugin

hi, i'd like to access to dataSource configured in struts-config.xml in 
the Plugin init method.
But i don't have a clue how to do that.
Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: access to dataSource configured in struts-config.xml in a Plugin

Posted by Thibaut Lassalle <tl...@cvdunet.com>.
thank you for your help. I find the solution.

To access to database in a plugin method you can do:
        javax.sql.DataSource  aDataSource = 
(DataSource)servletc.getServletContext().getAttribute("dataBase1");
where dataBase1 is the key witch identify the data-source in the 
struts-config.xml


Martin Gainty a écrit :

> Thibault-
>
> Have you had the opportunity to look at
> http://www.docjar.com/html/api/org/apache/struts/action/ActionServlet.java.html 
> ?
> This is a customised ActionServlet which initialises data-sources thru 
> initModuleDataSources method
> and the initModulePlugIns method which initialises the PlugIns found 
> in the config file
> Is there a specific plugin you wish to use?
>
> Bonne Chance,
> Martin-
> ----- Original Message ----- From: "Thibaut Lassalle" 
> <tl...@cvdunet.com>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Monday, June 06, 2005 10:20 AM
> Subject: access to dataSource configured in struts-config.xml in a Plugin
>
>
>> hi, i'd like to access to dataSource configured in struts-config.xml 
>> in the Plugin init method.
>> But i don't have a clue how to do that.
>> Thanks.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: access to dataSource configured in struts-config.xml in a Plugin

Posted by Martin Gainty <mg...@hotmail.com>.
Thibault-

Have you had the opportunity to look at
http://www.docjar.com/html/api/org/apache/struts/action/ActionServlet.java.html ?
This is a customised ActionServlet which initialises data-sources thru 
initModuleDataSources method
and the initModulePlugIns method which initialises the PlugIns found in the 
config file
Is there a specific plugin you wish to use?

Bonne Chance,
Martin-
----- Original Message ----- 
From: "Thibaut Lassalle" <tl...@cvdunet.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Monday, June 06, 2005 10:20 AM
Subject: access to dataSource configured in struts-config.xml in a Plugin


> hi, i'd like to access to dataSource configured in struts-config.xml in 
> the Plugin init method.
> But i don't have a clue how to do that.
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


access to dataSource configured in struts-config.xml in a Plugin

Posted by Thibaut Lassalle <tl...@cvdunet.com>.
hi, i'd like to access to dataSource configured in struts-config.xml in 
the Plugin init method.
But i don't have a clue how to do that.
Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org