jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudha...@thej2ee.com
Subject Tag Interface and release() method.
Date Mon, 04 Oct 2004 17:45:32 GMT
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


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


Mime
View raw message