Bug 49589 - Tag handlers with constant attribute values are always reinitialized
Summary: Tag handlers with constant attribute values are always reinitialized
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Jasper (show other bugs)
Version: trunk
Hardware: PC All
: P2 enhancement with 1 vote (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2010-07-12 21:30 UTC by Jeremy Boynes
Modified: 2017-04-07 16:46 UTC (History)
0 users

Test JSP (1022 bytes, text/plain)
2010-07-12 21:33 UTC, Jeremy Boynes
Java source generated by Jasper <jspc> ant task (7.86 KB, text/plain)
2010-07-12 21:35 UTC, Jeremy Boynes

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Boynes 2010-07-12 21:30:47 UTC
Tags such as the JSTL <x:out> tag that have idempotent attribute values are being reinitialized before use. The specification allows the container to pool and reuse tags with the same attribute values, calling them multiple times without reinitializing the values. However, the code generated by Jasper always sets the attribute values after retrieving an instance from the pool even if they have constant values.
Comment 1 Jeremy Boynes 2010-07-12 21:33:02 UTC
Created attachment 25757 [details]
Test JSP
Comment 2 Jeremy Boynes 2010-07-12 21:35:05 UTC
Created attachment 25758 [details]
Java source generated by Jasper <jspc> ant task

Relevant snippet from end

//  x:out
    org.apache.taglibs.standard.tag.rt.xml.ExprTag _jspx_th_x_005fout_005f0 = (org.apache.taglibs.standard.tag.rt.xml.ExprTag) _005fjspx_005ftagPool_005fx_005fout_0026_005fselect_005fnobody.get(org.apache.taglibs.standard.tag.rt.xml.ExprTag.class);
    _jspx_th_x_005fout_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_x_005fforEach_005f0);
    // /org/apache/taglibs/standard/tag/el/xml/TestForEachPerformance.jsp(24,67) name = select type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    int _jspx_eval_x_005fout_005f0 = _jspx_th_x_005fout_005f0.doStartTag();
Comment 3 Mark Thomas 2012-01-22 19:45:04 UTC
I'm leaning towards marking this as WONTFIX. Trying to write the code to do this even for simple cases looks like it will increase the complexity of the generation code significantly.
Comment 4 Mark Thomas 2017-04-07 16:46:35 UTC
As per comment #3, closing.