jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Nguyen" <dngu...@eb2x.com>
Subject RE: connectionPooling with Tags?
Date Fri, 16 Nov 2001 20:48:06 GMT

If I didn't misunderstand you, I face the same problem. What I did is
probably a hack but reasonable. Anyone care to comment? - if this question
"how to reuse your db connection for other (<sql:statement..> tags in) JSPs"
is well documented it may help others as well.

The fact is, as most other tag handlers, <sql:connection ..> tag
communicates the database connection to the <sql:statement ..> tag via
pageContext. And the StatementImplTag actually uses
pageContext.findAttribute() instead of .getAttribute() to get the database
connection object which makes this trick even more convenient.

So if I want to _reuse_ my database connection I just put it in the session
object, some time before the jsp page in question is accessed, for example
in some controller servlet/Jsp, as follows:

session.setAttribute("dbConnection", dbConn);

And then in my JSP page I can simply say:
<sql:statement id="s1" conn="dbConnection">

It works well for me. Of course you must be careful to decide when to close
the connection. I just leave it open during user session.

Hope it helps,

BTW, I do the connection pool myself.

-----Original Message-----
From: Dennis Völker [mailto:dvoelker@raie.de]
Sent: Friday, November 16, 2001 9:50 AM
To: taglibs-dev@jakarta.apache.org
Subject: connectionPooling with Tags?


I´m developing an application using dbTags, but it´s very slow.
How can I export a connection implemented with the connectionTag to
another JSP-page?
Is there any implmentation of a connectionPool-Tag out there?

On the other hand I have a ConnectionPool-Bean, but I want to avoid
scriplets in the JSP-pages.
How do I can combine a connection Implemented with scriplet with the

thanks a lot


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>

View raw message