Bug 26320 - <c:out> doesn't work properly when tag handlers are pooling
Summary: <c:out> doesn't work properly when tag handlers are pooling
Status: RESOLVED FIXED
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: unspecified
Hardware: All All
: P3 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-21 19:00 UTC by Felipe Leme
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Felipe Leme 2004-01-21 19:00:00 UTC
A friend of mine (Jailton Lopes) reported a wierd behaviour in the following code:

JSP:
<c:out value = "${requestScope.dummyValue}">
ABCDEFGHIJLMN<br>
</c:out>
<c:out value = "${requestScope.otherDummyValue}"/>
 
Output:
ABCDEFGHIJLMN
ABCDEFGHIJLMN


The problem is that the second call to <c:out> is printing the default value of
 the previous call (which was set in the tag's body).
 
After some research, I realized that's caused because Tomcat is pooling the 
tag handlers and OutSupport returns EVAL_BODY_BUFFERED. One way to solve the
problem is setting Tomcat to not pool the handlers, but that's not an elegant
solution. The ideal solution would be delegate the task of cleaning up its state
to the tag handlers. As the tag handler API doesn't have a init() or similar
method, we can do that on doStartTag(), as shown below:

Original code:

public int doStartTag() throws JspException {
    needBody = false;                       // reset state related to 'default'

New code:

public int doStartTag() throws JspException {
    needBody = false;                       // reset state related to 'default'
    this.bodyContent = null;                // clean-up body (just in case
container is pooling tag handlers)



I'm doing these changes now, so we can fix this issue on 1.0.5 and 1.1.0.
Comment 1 Felipe Leme 2004-01-21 19:25:27 UTC
Committed changes to CVS - waiting for TCK tests to mark bug as fixed.
Comment 2 Felipe Leme 2004-01-22 01:29:24 UTC
Closed, as TCK ran fine.