Struts 2 nesting iterators

后端 未结 4 683
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-03 22:06

I can\'t believe how something this simple can seem so hard to do in Struts 2.

This is approximately what I would like to do as it would be done in Java.

         


        
4条回答
  •  南方客
    南方客 (楼主)
    2020-12-03 22:46

    For Struts 2.3.x you can use this example, extracted from http://struts.apache.org/release/2.3.x/docs/iterator-tag-examples.html

    In this example, 'countries' is a list of country objects, each of which has a name and a list of cities. Each city has a name.

    
        
            , 

    They refer to a specific position on the stack: '[1]'. The top of the stack, position 0, contains the current city, pushed on by the inner iterator; position 1 contains the current country, pushed there by the outer iterator.

提交回复
热议问题