You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "F. Da Costa" <da...@xs4all.nl> on 2004/01/20 04:41:00 UTC

[.script] How to loop properly through a inner foreach using data from the outer foreach

Hi following a snip of a .script
The first foreach works as expected.
The second however is dependent on the first but it looks like the foreach 
is *not* using the seg from the outer foreach but a 'dirty' variable from 
the .jave instead.

I've got a similar setup working perfectly in a html template.

Two questions actually arose.
1. Does the .script, using a foreach, also set values or not?
2. What would be the correct way to do something like this? (ie. a double 
loop whereby the inner loop gets its objects from each individual object of 
the outer loop)

...
<foreach key="seg" expression="page.allBranches">
  <if expression="seg.leafs.length>0">
   <foreach key="leaf" expression="seg.leafs">
   s = new String("${leaf.label}");
   sv.put(s, ["${segment.nodeLevel}" ,"${page.leafId}"]);
   </foreach>
  </if>
</foreach>
...

TIA

Fermin DCG


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


[RESOLVEDt] How to loop properly through a inner foreach using data from the outer foreach

Posted by "F. Da Costa" <da...@xs4all.nl>.
F. Da Costa wrote:
> ....
> <foreach key="seg" expression="page.allBranches">
>  <if expression="seg.leafs.length>0">
>   <foreach key="leaf" expression="seg.leafs">
error in seg.leafs stuffed me up
>   s = new String("${leaf.label}");
>   sv.put(s, ["${segment.nodeLevel}" ,"${page.leafId}"]);
>   </foreach>
>  </if>
> </foreach>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org