如何在struts2迭代器标记中获取NEXT项

时间:2022-07-27 18:19:19

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

我知道*没有一个大的struts2社区。但我还在试试我的运气:)

I have scriplet code such as this:

我有这样的scriplet代码:

<%
                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.

dvo3_a,dvo_b,dvo_c用于循环的每次迭代。请注意iter1.next()获取下一个项目。所以基本上在一次迭代中我得到3个元素。

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.

我试图将上面的代码转换为struts2迭代器标签然而,看看文档中提供的示例和信息我不认为它是可能的吗?我真的很讨厌,如果我必须改变我的数据集以克服struts2 iterator标签的这个缺点,它会很难过。

1 个解决方案

#1


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.

Struts2 Iterator不支持您想要做的事情。你的代码很好,你想转移到struts迭代器的原因是什么。如果不是在jsp中使用java代码但是使用标记,那么你已经为iterator编写了自己的自定义标记,它提供了你需要的功能。

#1


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.

Struts2 Iterator不支持您想要做的事情。你的代码很好,你想转移到struts迭代器的原因是什么。如果不是在jsp中使用java代码但是使用标记,那么你已经为iterator编写了自己的自定义标记,它提供了你需要的功能。