webwork iterator 遍历双重list

经常会需要遍历双层的list,可以用脚本语言,但如果想用标签的话,
一直没有找到很好的做法,偶尔从朋友得到答案,下边是个例子:
构造一个双层列表:
outList  =   new  ArrayList();
 
inList
=   new  ArrayList();
inList.add(
new  Element( " 1 " , " a " ));
inList.add(
new  Element( " 2 " , " b " ));
outList.add(inList);
 
inList
=   new  ArrayList();
inList.add(
new  Element( " 3 " , " c " ));
inList.add(
new  Element( " 4 " , " d " ));
outList.add(inList);

遍历:
< ww:iterator value = " outList " >
    
< ww:iterator value = " top " >
          
< ww: property value = " key " /> , < ww: property value = " value " />
    
</ ww:iterator >
</ ww:iterator >


注意:关键点就一个top,意思是取栈顶的元素.

你可能感兴趣的:(C++,c,脚本,C#,Webwork)