IIRC, a tag handler instance can only be reused for another tag with the same set of attributes. I believe your example fails to meet that criterion. I'm also not sure that a JDBC connection is a good example of something to dispose of in the release method. It's probably a better idea to do something like have the tag handler implement TryCatchFinally and close the connection in the doFinally method.
Quoting [EMAIL PROTECTED]: > Tag Interface and release() method. > > http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release() > > The API says - public void release() - Called on a Tag handler to release > state. The page compiler guarantees that JSP page implementation objects > will invoke this method on all tag handlers, but there may be multiple > invocations on doStartTag and doEndTag in between. > > It sounds to me that one can't rely on release() method for cleaning the > internal variable state. It should be only used for releasing other > resources (like JDBC connection). > > > <c:out value="${myvar1}" escapeXml="false" /> > <c:out value="${myvar2}" /> > > > According to API, the above code may have no xml escaping for myvar2 if > container reuses the Tag without calling release(). Also when I checked > code for JSTL (apache taglib project), I found their code relying on > release() method and expecting invocation of release() before the Tag is > returned to container pool. This means implementation JSTL by apache > taglib will behave unexpected if page compiler will not call release() in > every cycle (which is totally valid according to API). Any optional > attributes may have non-default value based on their earlier invocation. > > I also checked JSP compiled code (by WebLogic 8.1 JSP compiler) for > similar kind of code and found that they are invoking release() during > every cycle. So we are safe now, but some container can skip this and... > > Any comments? > > Regards, > Sudhaker -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
