The following will work:
pageContext.getServletContext().getAttribute("dbPool");
-----Original Message-----
From: Jason Johnston [mailto:[EMAIL PROTECTED]]
Sent: 24 September 2002 17:25
To: <"Tomcat Users List"
Subject: Retrieving ServletContext Objects via PageContext
This may be a stupid question but I'm just starting to use custom tags and
I'm running into a strange problem. I'm using a DBCP for a mySQL database
and my setup servlet places a handle to the pool in the ServletContext via
the setAttribute() under the name "dbPool."
Now other servlets can retrieve the pool handle fine and get a connection
and do their business. However my tag, which extends TagSupport can't seem
to find the pool. Initially, I used
getServletContext.getAttribute("dbPool"). Of course, I got a compile error
telling me that there is no such method.
After some reading, it appeared that what I'm looking for should be
available via
the pageContext.getAttribute("dbPool",pageContext.APPLICATION_SCOPE);
However, I'm still not getting a handle on the DB Pool. I know there's
probably somethings fairly simple I'm missing here, either syntax or
concept. Could someone give me some insight. Thanks.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>