On Mon, 3 Feb 2003, Felipe Schnack wrote:
> Hm... so this is standard behavior? release() is called after
> doEndTag() in all containers that use pooling?
The release() method is called only after the last time that a tag has
been used, before it gets returned to the pool (in a pooling container).
It is *not* called in between reuses of the same tag instance, whether
the container pools tags or not.
As I've stated earlier, you shouldn't be modifying the attribute values
set by the JSP page in any of your doXxx() methods at all. From Section
JSP.10.1:
"Once properly set, all properties are expected
to be persistent, so that if the JSP container
ascertains that a property has already been set
on a given tag handler instance, it needs (sic.) not
set it again.
In other words, if you use tags like this:
<foo:bar baz="a"/>
<foo:bar baz="a"/>
and the container decides to reuse the instance, you cannot expect that a
second setBaz("a") call will be generated (an optimizing compiler will
almost certainly omit it). If you've modified the value of the "baz"
instance variable inside your tag, and expected it to get reset to "a"
again, your tag is broken, and is pretty sure to not work as desired on at
least some containers.
Depending on where you do your state setting on *other* instance variables
(i.e. those that do not represent attribute values), the following is the
recommended spot to clean things up:
* In the constructor, or in initialization expressions on the
variable declaration --> clean up in release().
* In the doStartTag(), doInitBody(), doAfterBody(), or doEndTag()
methods --> you can still clean up in release(), but can also
choose to clean up at the end of doEndTag() or doFinally()
if you really need to. That would only be appropriate if you've
allocated some expensive resource in doStartTag() and want to
release it as quickly as possible.
Craig
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]