cool, Jim, thats a better solution!!

So I'll have something like this to create my iteratorList

int sizeList = dataList.size();
List iterList = new ArrayList();

for (i = 0; i <= sizeList; i=i+2)
{
   iterList.add(i);
}


    So now I have a iterList. I can iterate over it in my struts2 code

<s:iterate value="iterList" statue="stat">
    <s:property value="((myClass)dataList.get(stat)).someClassMethod"/>
<!--first item of dataList ->

    <s:property value="((myClass)dataList.get(stat+1)).someClassMethod"/>
<!--second item of dataList ->

</s:iterate>


Will this work in regards to struts2 html tags?




On Sun, May 31, 2009 at 10:08 AM, Dave Newton <newton.d...@yahoo.com> wrote:

> Jim Kiley wrote:
>
>> Assuming that you're iterating over a List, why not instead iterate over a
>> List of Integers, and use those Integers as the index to your iterator?
>>  You
>> can increment the counter inside the iterator.  Or if you need to get
>> foo[0]
>> and foo[1] on the first run through, foo[2] and foo[3] on the next run,
>> you
>> could iterate over a List {0, 2, 4, 6, 8...} and get dataList[i] and
>> dataList [i + 1].  It's easy enough to dynamically generate the List of
>> Integers in your action class.
>>
>
> Yep--that was the "just use the index" bit, but I'm grumpy today and didn't
> feel like spelling it out :)
>
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to