开发者

iterate an Array List in Struts2

开发者 https://www.devze.com 2023-02-13 11:03 出处:网络
I have a list and reach entry in the list is an other list.I have this 开发者_如何学JAVAlist ready with me, all i want to do is to display it through jsp.

I have a list and reach entry in the list is an other list. I have this 开发者_如何学JAVAlist ready with me, all i want to do is to display it through jsp.

How do I iterate a list which return one more list.

Any help is appreciated.

Regards, Senny


See: http://struts.apache.org/2.0.11/docs/iterator.html

Following should work, not tested:

<s:iterator value="parentList">
    <s:iterator>
        <s:property/>
    <s:iterator>
</s:iterator>

The inner iterator I think should use the current value pushed onto the stack by the outer iterator. The S2 property tag does the same.

If you have more complicated nesting, you add the var property to the parent iterator with a value. This value then becomes the name of the pushed value inside the iterator.

An example of this:

<s:iterator value="parentList" var="referencedAs">
    <s:iterator value="referencedAs">
        <s:property/>
    <s:iterator>
</s:iterator>
0

精彩评论

暂无评论...
验证码 换一张
取 消