If we made the getIndex() and getValue() methods of Loop public, then you
could:


       <span t:id="loop" source="1..5">
               ${loop.currValue}<br/>
       </span>

But then you must define your loop in your Java class and expose it as a
property:

@Component
private Loop _loop;

public Loop getLoop() { return _loop; }


.... however that won't work currently, because those methods are not
visible.  If you add an issue, it's a few second's work to make them public.

On 10/14/07, Nick Westgate <[EMAIL PROTECTED]> wrote:
>
> I can see what you mean, though it is quite common to use the index inside
> the page class too. T5 keeps things simple to cover the most common cases.
>
> You can create your own components if you don't like the default ones.
> It would be interesting to see an alternative if you write one.
>
> Cheers,
> Nick.
>
>
> Mohammad Shamsi wrote:
> > dear Nick,
> >
> > i want index just for iteration, i don't need it in may page class, i
> think
> > that its better to define in Loop component class,
> >
> > suppose that i want to use Loop, 5 times in a singe page, then i most
> define
> > 5 index value, and five item object ???
> >
> >
> >
> > On 10/14/07, Nick Westgate <[EMAIL PROTECTED]> wrote:
> >> The value and index have to go somewhere. Why not in your page class?
> >>
> >> Cheers,
> >> Nick.
> >>
> >>
> >> Mohammad Shamsi wrote:
> >>> hi all,
> >>>
> >>> please take a look at my page bellow,
> >>>
> >>>         <!-- do i have to define item object in page class ?? i want
> to
> >> use
> >>> it just here in page ??? -->
> >>>         <t:loop source="items" value="item" >
> >>>
> >>>         <tr>
> >>>             <!-- i want to put an index here for each row in table -->
> >>>             <td> ??? </td>
> >>>             <td>${item.firstName}</td>
> >>>             <td>${item.lastName}</td>
> >>>             <td>${item.phone}</td>
> >>>         </tr>
> >>>         </t:loop>
> >>>
> >>> 1 - i just want to use  item object here, for iteration, i don't want
> to
> >>> define it at my page class, can i ?
> >>>
> >>> 2  - i need an index var for each row, but it seems that for use index
> >>> attribute in loop component, i have to define a property at my page
> >> class
> >>> first, :((
> >>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind

Reply via email to