日期:2014-05-16  浏览次数:20322 次

jsp页面传递数组到action
页面传递数组到action

jsp页面:<c:forEach items="${list}" var="guideMeasure" varStatus="i">
            
                 <tr>
                   <td>${i.index+1}</td>
                   <td>${guideMeasure.description}</td>
                    <td><input name="GDArr[${i.index }]"  type="radio"  value="${guideMeasure.id}" <c:forEach items="${listG}" var="guideDetailn" ><c:if test="${guideDetailn.measureId==guideMeasure.id&&guideTemplate.id==guideDetailn.templateId}">checked</c:if></c:forEach> />是
<input name="GDArr[${i.index }]" type="radio"   value="${guideMeasure.id}x" />否</td>

                 </tr>
               </c:forEach>

action:
private List<String> GDArr;

for(int i=0;i<GDArr.size();i++){  
String n=(String)GDArr.get(i);
int m=n.length();

String mn=n.substring(m-1);

if("x".equals(mn)){

this.delete(id, n.substring(0,m-1));
}
else{

if(this.guideDetailService.getGuideDetailByGuideDetailIdAndMeasureId(id, n.substring(0,m))==null){
this.add(id,n.substring(0,m));
}