2011/10/8 Kai <[email protected]> > <c:forEach var="i" begin="1" end="10" step="1"> > ... > The problem ist: > The EL-expression ${i} does not pick up the variable from the page-scope! > > > If I push the variable to request-scope with an <c:set var="i" value="${i}" > scope="request"/> inside the <c:forEach>-loop, everything works fine. But > that would polute the "global namespace" and might therefore lead to other > hard to find errors later on. Besides, using the EL-expression would be > pretty pointless than, because the variable is visible in the nested > definition anyway. > > > Am I missing something, is this a bug, or why is it not possible to pick up > variables from page-scope via EL-expressions in definitions? >
You're missing how the "var" attribute works: http://download.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/c/forEach.html At the "var" attribute I read: <snip> Name of the exported scoped variable for the current item of the iteration. This scoped variable has nested visibility. Its type depends on the object of the underlying collection. </snip> So it's got nested visibility, not page. Antonio
