1.一维数组

<s:iterator value="#request.headers" id="head" status="i">   <td>${i.count}</td>   <td>${head}</td> </s:iterator>

   <select class="select1" tabindex="2" id="selectname3" name="selectname3" >                              <s:iterator status="status" value="#request.select_acct"             id="item" >              <option value="item" />               <s:property value='item' />              </option>             </s:iterator> </select>

 

2.list

<s:iterator value= "{'1','2','3','4','5'}"  id= 'number' >      <s:property value= 'number' /> </s:iterator

3.map

<s:iterator value= "map"  id= "id"  status= "st" >       key : <s:property value= 'key' />       value:<s:property vlaue= 'value' />  </s:iterator>

4:遍历数据栈.简单的List类, List<Attr>  class Attr{String attrName;String getAttrName(){return "123";}}

<s:iterator value= "label"  id= "id" >      <s:property value= "#id.attrName"  />  </s:iterator>

5:遍历2个list; List<AttrName> attrN {color,size,style} List<AttrValue> attrV {red,20,gay} 这2个list的元素是一一对应的,一个attrN对应一个attrV

< s:iterator   value = "%{attrN }"   id = "id"     status = "status" >   index    is :  < s:property   value = 'status.index' />   attrName is :  < s:property   value = 'id' />  or  < s:property   value = '%{id}' />     attrName is :  < s:property   value = '%{attrV[#status.index]}' />  </ s:iterator > 

6.二维数组

struts2中二维数组的显示  1、用两重循环的方法

<s:iterator id="data1" value="#request.data" status="d1"> <s:iterator id="data2" value="#request.data1" status="d2"> <s:property value="#data2"/> </s:iterator> </s:iterator>

2、用一重循环的方法

<s:iterator value="collection1" status="status"> <s:property value="collection1[#status.index][0]"/> <s:property value="collection1[#status.index][1]"/> </s:iterator>