Are you using modules? Why don't you print out the contents of ServletContext to see if it's in there?

David



From: Jimmy Emmanual <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: Connection Pool
Date: Wed, 19 Mar 2003 19:23:40 -0500

David,

When i try to access it via the defined key, the DataSource object is null.
The only way it works is if i use the "Action.DATA_SOURCE_KEY" i.e.

ServletContext context = servlet.getServletContext();
DataSource dataSource =
(DataSource)context.getAttribute(Action.DATA_SOURCE_KEY);

If i try something like:

ServletContext context = servlet.getServletContext();
DataSource dataSource = (DataSource)context.getAttribute("Datasource1");

where "Datasource1" is the "key" in the struts-config.xml file, it doesn't
work...

-----Original Message-----
From: David Graham [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 19, 2003 7:23 PM
To: [EMAIL PROTECTED]
Subject: Re: Connection Pool


Struts stores the DataSources in the ServletContext under the key you defined.

David



>From: Jimmy Emmanual <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
>Subject: Connection Pool
>Date: Wed, 19 Mar 2003 19:18:11 -0500
>
>How do you access a DataSource from an action class via its "key"? I have
>multiple DataSources defined in the struts-config.xml file each have the
>"key" property set. I need to access these based on this "key".
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to