Tomcat 7.0 uses tag concatenation:
http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html
JSP Custom Tag Pooling - Java objects created for custom JSP tags can now be merged and reused. This greatly improves the performance of JSP pages that use custom tags.
This page also says that web.xml may contain the enablePooling option for this and that its default value is true.
So, I would say that disabling tag reuse is not a good idea, as it will lead to some performance loss.
Tomcat 7.0 ensures that the state of the tag class remains unchanged between doStartTag () and doEndTag ():
http://tomcat.apache.org/tomcat-7.0-doc/jspapi/javax/servlet/jsp/tagext/Tag.html
The doStartTag and doEndTag methods can be called in a tag handler. Between these calls, the tag handler is supposed to contain the state that should be saved
But the same paragraph also indicates between the brackets that the object must have its properties stored after:
After calling doEndTag, the tag handler is available for further calls ( and is expected to retain its properties ).
So what I do is reset all local variables to default before returning doEndTag (). I did not find an explanation on how combining and reusing Tomcat tags is implemented (e.g. TagHandlerPool.java), so I think this is the safest option.
Walid
source share