There is still a bug in Jasper 2 (tomcat 4.1.10) that generates incorrect code for IterationTag (s). There is no variable synchronization between doStartTag() and the loop body.
The following (snippet) of a jsp page with an IterationTag ... --- <snip> --- <p> I can count to ten. </p> <p> <ul> <lt:forEach list="<%=countToTen()%>" name="counter" type="java.lang.Integer"> <li> <%=counter%> </lt:forEach> </ul> </p> --- <snip> --- Generates the following servlet code ... --- <snip> --- /* ---- lt:forEach ---- */ looptest.tag.ForEachTag _jspx_th_lt_forEach_0 = (looptest.tag.ForEachTag) _jspx_tagPool_lt_forEach_type_name_list.get(looptest.tag.ForEachTag.class); _jspx_th_lt_forEach_0.setPageContext(pageContext); _jspx_th_lt_forEach_0.setParent(null); _jspx_th_lt_forEach_0.setList(countToTen()); _jspx_th_lt_forEach_0.setName("counter"); _jspx_th_lt_forEach_0.setType("java.lang.Integer"); int _jspx_eval_lt_forEach_0 = _jspx_th_lt_forEach_0.doStartTag(); if (_jspx_eval_lt_forEach_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { java.lang.Integer counter = null; do { out.write("\n "); out.write("<li> "); out.print(counter); out.write("\n "); int evalDoAfterBody = _jspx_th_lt_forEach_0.doAfterBody(); counter = (java.lang.Integer) pageContext.findAttribute("counter"); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_lt_forEach_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; _jspx_tagPool_lt_forEach_type_name_list.reuse(_jspx_th_lt_forEach_0); out.write("\n "); out.write("</ul>\n "); out.write("</p>\n "); --- <snip> --- I think that there should be variable synchronization code somewhere between doStartTag and the first out.write(). http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11552
looptest.tar.gz
Description: Binary data
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>