Mike,

> Cool!  One more question, is it possible to make the "inner" list
> parameterized with the value from the "outer" list?

Based on your question(s), it sounds like you you've done stuff like this
the before with struts or some equivalent.  Thankfully, tapestry is much
easier.

Try not to think to of it as passing parameters to the inner list.  All the
public properties of the object iterated over in you parent loop are
available within the nested loop.  The example below is a bit dumb because
it just repeats the artist's name within the nested loop after each
painting, but it shows how to do what I think your asking.

.html:
<!-- parent loop -->
<span jwcid="artists">
        <span jwcid="artistName"></span>
                <!-- child loop -->
                <span jwcid="paintings">
                        <LI><span jwcid="paintingTitle"></span>, 
                                        <span jwcid="artistName"></span>
                </span>
                <!-- end child loop -->
</span>
<!-- end parent loop -->

.page/.jwc:
<component id="artists" type="Foreach">
        <binding name="source" expression="artistList"/>
        <binding name="value" expression="artist"/>
</component>

<component id="artistName" type="Insert">
        <binding name="value" expression="artist.artistName"/>
</component>

<component id="paintings" type="Foreach">
        <binding name="source" expression="artist.paintingArray"/>
        <binding name="value" expression="painting"/>
</component>    
        
<component id="paintingTitle" type="Insert">
        <binding name="value" expression="painting.paintingTitle"/>
</component>

.java:
private List artistList; // assume this exists
public Artist artist; // iterator placeholder object
public Painting painting; // iterator placeholder object

Also, have a look at the component reference.  It has some really good
examples.

Cheers,
Eric

> -----Original Message-----
> From: Mike Starr [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 15, 2002 11:01 AM
> To: '[EMAIL PROTECTED]'
> Subject: [Tapestry-developer] Re: Nested Foreach components
> 
> 
> 
> Cool!  One more question, is it possible to make the "inner" list
> parameterized with the value from the "outer" list?  If so, 
> what is the
> syntax for this?
> 
> 
> -------------
> From: Howard M. Lewis Ship <[EMAIL PROTECTED]> 
>  Re: Nested Foreach components   
> 2002-10-15 03:25 
> 
> Of course this is supported.  Go wild.
>    ----- Original Message ----- 
>    From: Michael Starr 
>    To: [EMAIL PROTECTED] 
>    Sent: Monday, October 14, 2002 11:41 PM
>    Subject: [Tapestry-developer] Nested Foreach components
>  
>  
>    Newbie question...
>  
>    Is it possible to nest Foreach components?  I have a List 
> of lists that I
> would like to
> display in nested list fashion (unordered list of unordered lists)
>  
>    Thx!
>    -Mike
>  
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Tapestry-developer mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/tapestry-developer
> 


**********************************************************************
This message, including any attachments, contains confidential information intended 
for a specific individual and purpose, and is protected by law.  If you are not the 
intended recipient, please contact sender immediately by reply e-mail and destroy all 
copies.  You are hereby notified that any disclosure, copying, or distribution of this 
message, or the taking of any action based on it, is strictly prohibited.
TIAA-CREF
**********************************************************************


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer

Reply via email to