tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Petrelli <antonio.petre...@gmail.com>
Subject Re: EL-Expression in definition ignores page-scope
Date Sun, 09 Oct 2011 12:02:21 GMT
2011/10/8 Kai <kai@ich-geh-kaputt.de>

>      <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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message