tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 11552] - Iteration tags do not resynchronize scripting variables after doAfterBody()
Date Tue, 03 Dec 2002 20:19:14 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11552>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11552

Iteration tags do not resynchronize scripting variables after doAfterBody()





------- Additional Comments From drnathanshaw@yahoo.com  2002-12-03 20:19 -------
Can someone please clarify the design here for me?  I've been trying to 
upgrade from Tomcat 4.0.4 to 4.1.12 and can't get around a problem that looks 
related to this bug.

Say I have a custom tag which extends BodyTagSupport (and therefore implements 
BodyTag), returns EVAL_BODY_INCLUDE from doStartTag, and provides a NESTED 
scripting variable varNested.  I'd like to evaluate it in the body of the tag 
like this: 

<mytags:body>
   This is my body.
   <%= varNested%>
</mytags:body>

In Tomcat 4.0.4 this code works just fine.  On the first and only evaluation 
of the body, the scripting variable has been set by the tag handler.   In 
Tomcat 4.1.12, the variable is not initialized until doAfterBody which is too 
late for my purposes.  Here's the code fragment:

      if (_jspx_eval_mytags_body_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
        java.lang.String varNested = null;
        if (_jspx_eval_mytags_body_0 != 
javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
          javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody();
          _bc.clear();
          out = _bc;
          _jspx_th_mytags_body_0.setBodyContent(_bc);
          _jspx_th_mytags_body_0.doInitBody();
          varNested = (java.lang.String) pageContext.findAttribute
("varNested");
        }
        do {
          out.write("\r\n   This is my body.\r\n   ");
          out.print( varNested);
          out.write("\r\n");
          int evalDoAfterBody = _jspx_th_mytags_body_0.doAfterBody();
          varNested = (java.lang.String) pageContext.findAttribute
("varNested");
          if (evalDoAfterBody != 
javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
            break;
        } while (true);
        if (_jspx_eval_mytags_body_0 != 
javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
          out = pageContext.popBody();
      }

What am I missing?
Nathan

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message