checkbox为空

<view:qrytr>
<view:qrytd width="15%" heightshow="true">请选择执法范围:</view:qrytd>
<view:qrytd width="35%" colspan="3">
<s:checkboxlist name="map.ZFFWDM" list="#request.jcryMap" value="#request.depzf" id="zffwdm"></s:checkboxlist>
</view:qrytd>
</view:qrytr>
 
function check(){
if(!$("#form1").checkForm()) {
return false;
}
 
var rylist='';
var qxs = document.frames("jcry").document.getElementsByName("qx");
for(var i=0;i<qxs.length;i++){
if(qxs[i].checked){
rylist+=qxs[i].value+",";
}
}
if(rylist == '' || rylist == null){
alert("请至少选择一名执法人员!");
return false;
}
var zffwlist='';
var zffw = document.getElementsByName("map.ZFFWDM");
for(var i=0;i<zffw.length;i++){
if(zffw[i].checked){
zffwlist+=zffw[i].value+",";
}
}
if(zffwlist == ''|| zffwlist == null){
alert("请至少选择一项执法范围!");
return false;
}
 
var url="<%=webapp%>/jcrygl/jcryglAction!insert.dhtml?ryids="+rylist;
$.ajax({
url:url,
type: 'post',
async: true,
data:$("#form1").serialize(),
complete: function(request, status) {
var txt = request.responseText;
if("true" == txt) {
window.location.href="<%=webapp%>/jcrygl/jcryglAction!list.dhtml?firstFlag=clear";
} else {
alert("提示:操作失败");
return false;
}
}
});
}
 
 JAVA后台
public String insert() throws Exception
{
String ryids=super.getRequestParameter("ryids");
String ids []=ryids.split(",");
String zffwdm=map.get("ZFFWDM").trim();
String zffwmc="";
String zffwdmnew="";
if(!"".equals(zffwdm)&&zffwdm!=null){
String zffwdms [] =zffwdm.split(",");
for(String zffw:zffwdms){
zffwmc+=StandardCodeTable.getName("jcryzffw", zffw.trim())+",";
zffwdmnew+=zffw.trim()+",";
}
}
for(String id:ids){
Map<String, String> mapUser = new HashMap<String, String>();
mapUser.put("userid", id);
mapUser.put("zffwdm", zffwdmnew);
mapUser.put("zffwmc", zffwmc.substring(0, zffwmc.length()-1));
jcryglService.insertJcryglDTO(mapUser);
}
super.renderText("true");
return null;
}
 
posted @ 2019-05-31 16:46  那些年的代码  阅读(462)  评论(0编辑  收藏  举报