先看看我的代码吧 我是新手 所以有好多部懂的
首先是从jsp中获取 saveGb80的地址
@ResponseBody
@RequestMapping(value = "saveGb80.ajax", method = RequestMethod.POST, produces = { "application/json;charset=UTF-8" })
public String saveGb80(String agb800_w) {
JSONObject json = new JSONObject();
json.put("flag", wzaaService.saveGb80(agb800_w));
return json.toString();
}
然后获取他的主键 agb800_w
@Transactional
public String saveGb80(String agb800_w) {
if(gb80Dao.queryByAgb800_w(agb800_w) > 0) {
return "false";
} else {
return "true";
}
}
最后是这样
@param agb800_w
@return
public int queryByAgb800_w(String agb800_w) {
Bricks bricks = new Bricks(this);
bricks.eq("agb800_w", new BigDecimal(agb800_w));
return findByBricks(bricks).size();
}
结果报的500 错误 求大神为我解答 谢谢
我的js代码 是这样的
//function doSave() {
if (AW.setFormErrorTip("#form1", AW.validateForm("#form1", validation_form1)) == null) {
var agb80e = $("#agb80e").val();
if (parseInt(agb80e) >= 2) {
AW.msg({
title : "系统提示",
content : "已提交不能再次保存修改!",
showClose : true,
onClose : function() {
},
width : 300,
buttons : [ {
title : "关闭",
click : function(wrap) {
wrap.modal("hide");
setTimeout(function() {
wrap.remove();
}, 4000);
}
} ]
});
return;
}
AW.post({
url : appPath + "/tjwb/wz/a/a/saveGb80.ajax",
data : $("#form1").serializeAll(),
success : function(data) {
if(data.flag == "success") {
AW.post({
url : appPath + "/tjwb/wz/a/a/saveGb80.ajax",
data : $("#form1").serializeAll(),
success : function(data) {
if (data.flag == "success") {
AW.msg({
title : "系统提示",
content : "保存成功!",
showClose : true,
onClose : function() {
wrap.remove();
AW.refreshForm("#form1", data.gb80);
dosubmit(pagenumnow, data.gb94.agb800_w);
},
width : 300,
buttons : [ {
title : "关闭",
click : function(wrap) {
wrap.modal("hide");
AW.refreshForm("#form1", data.gb80);
dosubmit(pagenumnow, data.gb94.agb800_w);
setTimeout(function() {
wrap.remove();
}, 4000);
}
} ]
});
} else {
AW.msg({
title : "系统提示",
content : "保存失败,请核查!",
showClose : true,
onClose : function() {
},
width : 300,
buttons : [ {
title : "关闭",
click : function(wrap) {
wrap.modal("hide");
setTimeout(function() {
wrap.remove();
}, 4000);
}
} ]
});
}
}
});
}else{
AW.msg({
title : "系统提示",
content : "xxxx!",
showClose : true,
onClose : function() {
},
width : 300,
buttons : [ {
title : "关闭",
click : function(wrap) {
wrap.modal("hide");
setTimeout(function() {
wrap.remove();
}, 4000);
}
} ]
});
}
}
});
}
}
这是一个 保存校验操作