Bug 19361 - Nested tags with scripting variables generates invalid code
Summary: Nested tags with scripting variables generates invalid code
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 4
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 4.1.24
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL: http://www.sqlt.com
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-27 07:42 UTC by Paul Fernley
Modified: 2005-03-20 17:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Fernley 2003-04-27 07:42:11 UTC
Using a nested custom tag that creates a scripting variable leads Jasper to 
create invalid code. I don't believe that this is the same fault as bug # 
12432, but is possibly related. A sample tag handler class is:

public class TestTag extends TagSupport {
    static int num = 1;
    String val = null;

    public void setVal(String val) {
        this.val = val;
    }

    public int doStartTag() throws JspException {

        /* Store the scripting variable */
        pageContext.setAttribute(val, new Integer(num++));

        return EVAL_BODY_INCLUDE;
    }

    public void release() {
        val = null;
    }
}

A sample JSP is:

<%@ taglib prefix="lib" uri="/testlib" %>
<HTML>
<BODY>
    <lib:testtag val="one">
        <lib:testtag val="two"/>
        <p>Val after the inner tag is <%=two%></p>
    </lib:testtag>
    <p>Val after the outer tag is <%=one%></p>
</BODY>
</HTML>

The sample output is:

  Val after the inner tag is null

  Val after the outer tag is 1

I think that the 'Val after the inner tag' should be 2 (at least, that's the 
way it worked in Tomcat v3.x and also in other containers such as JRun).
Comment 1 Kin-Man Chung 2004-03-27 01:06:28 UTC
Fixed in CVS