当前位置: 代码迷 >> Web前端 >> Struts2 <s:iterator> 遍历 List<Map<String, String>>
  详细解决方案

Struts2 <s:iterator> 遍历 List<Map<String, String>>

热度:1352   发布时间:2012-06-28 15:20:03.0
Struts2 <s:iterator> 遍历 List<Map<String, String>>

<s:iterator value="#request.list" id="map" status="stat">
???<tr>
?????? <td class="tablebody1" align="center">
?????&nbsp;<s:property? value="#stat.count" /></td>
????<td class="tablebody1" align="center">
?????&nbsp;${map.drug_no }</td>
????<td class="tablebody1" align="center">
?????&nbsp;${map.drug_name }</td>
????<td class="tablebody1" align="center">
?????&nbsp;${map.stock_pack_type }</td>
????<td class="tablebody1" align="center">
?????&nbsp;${map.stock_pack_unit }</td>
????<td class="tablebody1" align="center">
?????&nbsp;${map.drug_batch_no }</td>
????<td class="tablebody1" align="center">
?????&nbsp;${map.num }</td>
????<td class="tablebody1" align="center">
?????&nbsp;${map.retail_price }</td>
????<td class="tablebody1" align="center">
?????&nbsp;${map.vendor }</td>
????<td class="tablebody1" align="center">
?????&nbsp;${map.validity_date }</td>
????<td class="tablebody1" align="center">
??????????????????? &nbsp;<img src="<%=imgPath %>/add/editt.gif" onMouseOver="this.style.cursor='hand'"
???????border="0" onClick="edit('${map.row_id }')" /></td>
????<td class="tablebody1" align="center">
?????&nbsp;<img? src="<%=imgPath %>/add/delete.gif" onMouseOver="this.style.cursor='hand'"
??????????? border="0" onClick="del('${map.row_id }')">&nbsp;</td>
???</tr>
??</s:iterator>

?

说明:<s:iterator value="#request.list" id="map" status="stat">
#request.list: 后台request.setAttribute("list", list); 保存值

map:? list中保存的是Map

stat:? 获取遍历索引

?

${map.retail_price }:通过EL表达式获取Map中的值

  相关解决方案