struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lowe <mark.l...@talk21.com>
Subject Re: Accessing Struts Datasource from another action servlet
Date Mon, 02 Feb 2004 09:46:06 GMT
have you not seen the threads regarding the struts datasource?

the party line seems to frown upon it as it encourages breaking with 
MVC, unless you pass the connection up to the model tier.

that said, in your shoes I'd configure a datasource in the second 
webapp (albeit with the same config values) rather than trying to pass 
from one to the other.

I'd also suggest that storing datasources in the session isn't ideal 
but thats just my opinion.

Cheers Mark

On 2 Feb 2004, at 10:28, James MacKenzie wrote:

> Hi Guys,
>
> I have a web application written in Stuts and am writing a scheduler 
> which
> is a seperate action servlet which is configured in the web.xml file to
> start at startup.
> All of my other action classes are session based so they can get the
> default datasource (From the struts-config.xml)  from the session 
> using;
> DataSource ds = getDataSource(request);
> I also store this datasource in the session so that I can access it 
> from
> jsp's or pass it to other standalone servlets for background database
> processing and this approach seems to work well. I can't use this 
> approach
> for the scheduler though as I can't guarantee that anyone will start a
> session so I can pass the datasource.
>
> My question is, how do I use the struts datasource in my scheduled
> servlet?
>
> Thanks for any help!
>
> Regards, James
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Mime
View raw message