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. jk
On Sun, May 31, 2009 at 9:58 AM, Bhaarat Sharma <bhaara...@gmail.com> wrote: > sadly in my case i need to :( > > But this takes us back, the pseudocode you are suggesting is not possible > using s:iterate, I dont think we have the ability to move the cursor (or > current value in top stack) withtin the iterator tag. Neither does jstl > provide this. So sadly, will my code have to sit back in time and use > scriptlets. > > On Sun, May 31, 2009 at 9:49 AM, Dave Newton <newton.d...@yahoo.com> > wrote: > > > Bhaarat Sharma wrote: > > > >> how would 'if' help with 'next'. can you please give an example? > >> > > > > Pseudocode Java; this is something people should be able to figure out > for > > themselves. In JSP I might just use the index. > > > > for (Foo curr : foos) { > > if (alt) { > > ... > > } else prev = curr; > > alt = !alt; > > } > > > > OTOH, I'd probably never *need* to do this. > > > > > > Dave > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > > For additional commands, e-mail: user-h...@struts.apache.org > > > > > -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com