Summary: | JSTL "c:out" uses body-default, even if value is not NULL or "" | ||
---|---|---|---|
Product: | Taglibs | Reporter: | Nathanael Obermayer <nathob> |
Component: | Standard Taglib | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED DUPLICATE | ||
Severity: | critical | ||
Priority: | P3 | ||
Version: | 1.1 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All |
Description
Nathanael Obermayer
2002-09-25 07:43:26 UTC
Actually there are two problems here: 1) Jasper one - if tag implements body tag support and sometimes body is empty and sometimes not, then we may have next problem: a)Tag uses body (bodyContent set) b)Tag sent to pool (bodyContent set) b)Tag uses empty body (old bodyContent set). I've resolved this by setting bodyContent attribute to null before sending tag to pool: Generator.java, line 1440: if (ctxt.getOptions().isPoolingEnabled()) { //We must reset body before sending to pool if it was set before if (n.implementsBodyTag() && n.getBody() != null) { out.printin(tagHandlerVar); out.println(".setBodyContent(null);"); } out.printin(n.getTagHandlerPoolName()); out.print(".reuse("); out.print(tagHandlerVar); out.println(");"); } Second problem is with standart taglib: it uses needBody variable, but do not resets it to false in StartTag ( and we may be NOT called release between uses) Fix is: OutSupport.java, line 122: public int doStartTag() throws JspException { try { needBody = false; // print value if available; otherwise, try 'default' if (value != null) { out(pageContext, escapeXml, value.toString()); return SKIP_BODY; } else { |