You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by dp <dp...@gmail.com> on 2012/06/06 16:25:23 UTC

HowTo break out of a Tapestry loop?

So, i am trying to break out of tapestry loop here.

This is my -more or less- simplified scenario:

<ul>
    <t:loop source="firstSource" value="firstValue">
            <li>
                <t:loop source="firstValue" value="secondValue">
                    <p>${secondValue}</p>
                </t:loop>
                <t:loop source="secondSource" value="thirdValue">
                    <p>${thirdValue}</p>
                </t:loop>
            </li>
    </t:loop>
</ul>

What I do not want to have is: Tapestry loops through all entries in
firstValue - then loops through all entries in secondSource. I do not want
to iterate through secondSource inside the loop of fristValue as this would
iterate through all entries in secondSource - and I just want to do 1
iteration at a time.

What I want to have is: Tapestry enters the loop for firstValue and does
some printing or whatever, then breaks after the first iteration and jumps
into secondSource to do the first iteration . After it has finished it jumps
back to firstValue and repeats these steps. This is what in Java the
"break;" would do.

I did not find a clue in the Tapestry documentation on how to do this, nor
in the forums.

But it has to be possible in some way. I can not imagine I am the only one
trying to do this.


--
View this message in context: http://tapestry.1045711.n5.nabble.com/HowTo-break-out-of-a-Tapestry-loop-tp5713658.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: HowTo break out of a Tapestry loop?

Posted by dp <dp...@gmail.com>.
Thanks, I have done it with some conditional testing for now but am pretty
sure that for a long term solution creating a new data structure with all
necessary fields would be easier to manage.

Please also refer to the stackoverflow question:
http://stackoverflow.com/questions/10916019/howto-break-out-of-a-tapestry-loop

--
View this message in context: http://tapestry.1045711.n5.nabble.com/HowTo-break-out-of-a-Tapestry-loop-tp5713658p5713686.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: HowTo break out of a Tapestry loop?

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Wed, 06 Jun 2012 11:38:21 -0300, Steve Eynon  
<st...@alienfactory.co.uk> wrote:

> There is no 'break' in the loop component, but you can wrap your inner
> loops in a conditional <t:if test=".."> component.

Or pass the Loop component a list containing just the elements you do want  
to be rendered.

-- 
Thiago H. de Paula Figueiredo

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


Re: HowTo break out of a Tapestry loop?

Posted by Steve Eynon <st...@alienfactory.co.uk>.
There is no 'break' in the loop component, but you can wrap your inner
loops in a conditional <t:if test=".."> component.

Steve.

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