Found this at http://www2.real-time.com/rte-tomcat/2000/Jun/msg01487.html
--
The suggested approach is to store your connection pool object itself as
a servlet context attribute, like this:
ConnectionPool pool = new ConnectionPool( ... );
getServletContext().setAttribute("pool", pool);
Now, any servlet (or JSP page) in this web application can gain access
to the connection pool:
ConnectionPool pool = (ConnectionPool) getServletContext().getAttribute("pool");
without needing to gain access to a servlet instance itself.
Craig McClanahan
Matt Hughes <[EMAIL PROTECTED]>
10/20/2004 01:28 PM
|
|
Hi,
I am developing a web service for my application and am putting the
class in the same web context as the rest of my struts application.
However, I want to be able to get a DataSource object from within this
class. The only thing I have to connect the two is a ServletContext
object. How can I call Struts or get a hold of this DataSource object
when I am not in an Action class, etc.
---------------------------------------------------------------------
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]