当前位置: 代码迷 >> Java Web开发 >> 在获取jsp页面里的值为什么是空的,该怎么解决
  详细解决方案

在获取jsp页面里的值为什么是空的,该怎么解决

热度:91   发布时间:2016-04-13 22:19:52.0
在获取jsp页面里的值为什么是空的
jsp页面里的
<th class="center">
<label>
<input type="checkbox" class="ace" id="all" name="all" value = "" onclick="javascript:allCheck()"/>
<span class="lbl"></span>
</label>

action里的获取
public String deleteall(){
SysmaterialtypeBiz biz = new SysmaterialtypeBizImpl();
System.out.println(request.getParameterValues("all"));
String[] ids =  request.getParameterValues("all");
boolean b = biz.deleteall(ids);
if (b) {
return "deleteall";
} else {
return "error";
}
}

当我用debug时   输出request.getParameterValues("all")是一个NULL  这是为什么
------解决思路----------------------
在jsp里有几个控件的name为all,如果只有一个,那么肯定是null了

------解决思路----------------------
多选框没有选,那得到的string[]数组当然会是空的了,
  相关解决方案