tags:

views:

513

answers:

1

I know stackoverflow doesnt have a big struts2 community. But am still trying my luck :)

I have scriplet code such as this:

<%
                ArrayList statisticsList = something.getStatistics();
                Iterator itr1 = statisticsList.iterator();

                while (itr1.hasNext())
                {
                 dvo3_a = (VerificationVO) itr1.next();
                 dvo3_b = (VerificationVO) itr1.next();
                 dvo3_c = (VerificationVO) itr1.next();
                 ....
                    ....
                }
%>

dvo3_a, dvo_b, dvo_c are used in each iteration of the loop. Notice that iter1.next() gets the next item. So basically in one iteration I am getting 3 elements.

I am trying to convert the above to struts2 iterator tag However, looking at the examples and information provided in documentation I dont think it is possible? I would REALLY REALLY hate and it would SUCK if I have to change my dataset to overcome this drawback of struts2 iterator tag.

A: 

Struts2 Iterator doesn't support what you want to do. Your code is just fine, what is the reason you want to move to struts iterator. If it is to not use java code in your jsp but use a tag then you have write your own custom tag for iterator which provides the functionality you need.

Bhushan