• Struts2标签迭代数组汇总


    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> 

  • 相关阅读:
    虚拟PC上网设置
    打造无线AP
    ftp密码修改
    桌面
    红蜘蛛
    C++ Zip压缩解压缩[支持递归压缩]
    C++通过访问注册表获取已安装软件信息列表
    IOS Simulator Create Keyboard Shortcut
    简单的silverlight切图程序
    silverlight 反射调用WebService
  • 原文地址:https://www.cnblogs.com/zhangchi/p/3033047.html
Copyright © 2020-2023  润新知