P
plm
Hello,
I have always believed that due to the possibility of tag recycling,
that is the JSP engine may reuse tag instances (the only guarantee you
have is that no multiple threads are inside a tag instance at the same
time), one has to reset all non-mandatory attributes to their default
values in doEndTag(), that is before the tag may be used again.
I have seen various recommendations to do this.
However, all Struts tags do something else, something strange: they
reset the tag attributes to their default values in the release()
method, which is meant to release any resources (such as JDBC
connections etc) a tag instance might have. AFAIK an attribute value is
not a resource .
If I'm not wrong, release() is only called when the tag instance is
destroyed, not between reuses of the current tag instance. So the
struts way of doing things might lead to unexpected results, where tags
attributes of reused tags do not have their documented default values.
The question is, is my understanding of the JSP spec w.r.t. tag
recycling wrong, or is struts wrong?
Thanks for insight,
Peter
I have always believed that due to the possibility of tag recycling,
that is the JSP engine may reuse tag instances (the only guarantee you
have is that no multiple threads are inside a tag instance at the same
time), one has to reset all non-mandatory attributes to their default
values in doEndTag(), that is before the tag may be used again.
I have seen various recommendations to do this.
However, all Struts tags do something else, something strange: they
reset the tag attributes to their default values in the release()
method, which is meant to release any resources (such as JDBC
connections etc) a tag instance might have. AFAIK an attribute value is
not a resource .
If I'm not wrong, release() is only called when the tag instance is
destroyed, not between reuses of the current tag instance. So the
struts way of doing things might lead to unexpected results, where tags
attributes of reused tags do not have their documented default values.
The question is, is my understanding of the JSP spec w.r.t. tag
recycling wrong, or is struts wrong?
Thanks for insight,
Peter