- 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数量。