当前位置: 代码迷 >> JavaScript >> jsp页面传接数组到action
  详细解决方案

jsp页面传接数组到action

热度:280   发布时间:2012-09-19 13:43:54.0
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));
}
  相关解决方案