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() [EMAIL PROTECTED] changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED ------- Additional Comments From [EMAIL PROTECTED] 2002-08-14 18:45 ------- David, I don't agree with your assessment that if BodyTag.doStartTag() returns EVAL_BODY_INCLUDE, scripting variables will not be synchronized at all for the first iteration. For example, the following JSP code fragment: <mytags:body> This is my body </mytags:body> where <mytags:body> refers to a custom tag extending BodyTagSupport and exposing 3 scripting variables: "varNested" (with NESTED scope), "varAtBegin" (with AT_BEGIN scope), and "varAtEnd" (with AT_END scope), yields the following servlet code fragment: int _jspx_eval_mytags_body_0 = _jspx_th_mytags_body_0.doStartTag(); if (_jspx_eval_mytags_body_0 != Tag.SKIP_BODY) { if (_jspx_eval_mytags_body_0 != Tag.EVAL_BODY_INCLUDE) { out = pageContext.pushBody(); _jspx_th_mytags_body_0.setBodyContent((BodyContent) out); _jspx_th_mytags_body_0.doInitBody(); varAtBegin = (java.lang.String) pageContext.findAttribute("varAtBegin"); varNested = (java.lang.String) pageContext.findAttribute("varNested"); } do { out.write("\n This is my body\n"); int evalDoAfterBody = _jspx_th_mytags_body_0.doAfterBody(); varAtBegin = (java.lang.String) pageContext.findAttribute("varAtBegin"); varNested = (java.lang.String) pageContext.findAttribute("varNested"); if (evalDoAfterBody != BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_mytags_body_0 != Tag.EVAL_BODY_INCLUDE) out = pageContext.popBody(); } if (_jspx_th_mytags_body_0.doEndTag() == Tag.SKIP_PAGE) return; varAtBegin = (java.lang.String) pageContext.findAttribute("varAtBegin"); varAtEnd = (java.lang.String) pageContext.findAttribute("varAtEnd"); As you can see, the variables with NESTED and AT_BEGIN scopes are synchronized after the call to doInitBody(), and then again inside the do-while loop after the call to doAfterBody(). This is compliant with the spec. Your proposed patch would remove the synchronization after doInitBody(), and add synchronization (inside the do-while loop) before the call to doAfterBody(), as follows: int _jspx_eval_mytags_body_0 = _jspx_th_mytags_body_0.doStartTag(); if (_jspx_eval_mytags_body_0 != Tag.SKIP_BODY) { if (_jspx_eval_mytags_body_0 != Tag.EVAL_BODY_INCLUDE) { out = pageContext.pushBody(); _jspx_th_mytags_body_0.setBodyContent((BodyContent) out); _jspx_th_mytags_body_0.doInitBody(); } do { varAtBegin = (java.lang.String) pageContext.findAttribute("varAtBegin"); varNested = (java.lang.String) pageContext.findAttribute("varNested"); out.write("\n This is my body\n"); int evalDoAfterBody = _jspx_th_mytags_body_0.doAfterBody(); varAtBegin = (java.lang.String) pageContext.findAttribute("varAtBegin"); varNested = (java.lang.String) pageContext.findAttribute("varNested"); if (evalDoAfterBody != BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_mytags_body_0 != Tag.EVAL_BODY_INCLUDE) out = pageContext.popBody(); } if (_jspx_th_mytags_body_0.doEndTag() == Tag.SKIP_PAGE) return; varAtBegin = (java.lang.String) pageContext.findAttribute("varAtBegin"); varAtEnd = (java.lang.String) pageContext.findAttribute("varAtEnd"); ------------------------------------------------------------------------------- However, your remark about missing synchronization of IterationTag scripting variables after a call to doAfterBody (inside the do-while loop) is correct. I think this is a problem with the spec. According to JSP.10.5.9 ("VariableInfo"), NESTED scripting variables are synchronized after doInitBody and doAfterBody for a tag handler implementing BodyTag, and after doStartTag otherwise, and AT_BEGIN variables are synchronized after doInitBody, doAfterBody, and doEndTag for a tag handler implementing BodyTag, and doStartTag and doEndTag otherwise. No mentioning of tag handlers implementing IterationTag. However, as you pointed out, synchronization should take place after the invocation of IterationTag.doAfterBody() (according to JSP.10.1.2.4). I am going to seek clarification for this from the JSP spec leads and will let you know the outcome. Jan -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
