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]

Reply via email to