I don't know if it is correct or not, but it is the way the internal
datasource manager in Struts behaves.
Anyway I wrote a plugin that "should" behave better:
http://sdsmanager.sourceforge.net/
I must say that using DataSource as part of a web application is not a
good practice (though I don't think so), and you "should" (again I don't
like it) put a DataSource definition in your container. And, as I saw in
Struts-dev mailing list, DataSource support will be removed in next
releases of Struts.
Ciao
Antonio Petrelli

Jean Stamm wrote:

>Hello,
>
>In a Struts app I use the standard DataSource interface to implement
>the connection pooling to my DB.
>
>I use it in my Actions, calling getDataSource with the request as
>argument like  getDataSource(request, "datasourcename").
>
>I also have a plug-in which puts an array of beans in the application
>scope to be used in select drop-down boxes on the different forms of
>my app (the values of the select never changes, then I prefer this
>option than populating forms at each request, which is obviously extra
>db connection).
>
>In the plug-in, I connect to the db by using the datasource. Since I
>cannot get any request within the plug-in class, I get the datasource
>from the servlet context in the init method by doing:
>
>sc = arg0.getServletContext();
>
>and (DataSource)sc.getAttribute("datasourcename")
>
>signature of init methid is: public void init(ActionServlet arg0,
>ModuleConfig arg1)
>
>This works well, but I would like to know if this is the right way of
>doing or not.
>
>Thanks in advance,
>Jean
>
>---------------------------------------------------------------------
>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]

Reply via email to