码迷,mamicode.com
首页 > 其他好文 > 详细

Struts2中iterator标签使用radio/input迭代传值

时间:2015-07-06 17:38:33      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:

  • iterator标签使用radio迭代传值

jsp页面代码:

<struts:iterator value="checkboxs" status="st" >

<td><struts:radio name="checkResultArray[%{#st.index}]" list="result" listKey="key" listValue="value" value="boxInfoCheckResult"></struts:radio></td>

</struts:iterator>

其中 list="result"  :result为枚举集合, value="boxInfoCheckResult":boxInfoCheckResult为checkboxs中bean的对应字段。

后台action代码:

private static int boxNum; 

private Boolean[] checkResultArray=new Boolean[testNum];

public Boolean[] getCheckResultArray() {
return checkResultArray;
}

public void setCheckResultArray(Boolean[] checkResultArray) {
this.checkResultArray = checkResultArray;
}

其中boxNum为之前操作确定的box数量。

  • iterator标签使用input迭代传值

jsp页面代码:

<struts:iterator value="checkboxs" status="st" >

<td><input type="text" class="int" name="checkExplainArray[<struts:property value=‘#st.index‘/>]" value="<struts:property value=‘boxInfoCheckResultExplain‘/>"></td>

</struts:iterator>

其中  value="boxInfoCheckResultExplain":boxInfoCheckResultExplain为checkboxs中bean的对应字段。

后台action代码:

private static int boxNum;
private String[] checkExplainArray=new String[testNum];

public String[] getCheckExplainArray() {
return checkExplainArray;
}

public void setCheckExplainArray(String[] checkExplainArray) {
this.checkExplainArray = checkExplainArray;
}

其中boxNum为之前操作确定的box数量。

 

Struts2中iterator标签使用radio/input迭代传值

标签:

原文地址:http://www.cnblogs.com/linghai/p/4624830.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!