前端easyUI请求代码:
onLoadError: function (data) {
$.ajax({
type: "POST",
url: '${pageContext.request.contextPath}/E03/customGatherlistReturn',
dataType: "json",
async: false,
success: function (data) {
if (data.rawMaterialType != undefined){
layer.open({
title: '提示信息',
content: "原料名称:"+data.rawMaterialType+" "
+"原料规格:" +
data.rawMaterialSpecification+" "+"数
据有误,优化失败"
});
}
}
});
},
后端响应代码:
1.设置全局变量存放错误信息提示字段
private Gather customGathersituation = new Gather();
2.注意:!!!这个全局变量在方法初始化时需要重新new一次,让实体类字段为空,否则保留上回提错信息
3.自定义前端请求完成后触发的方法
@ResponseBody
@RequestMapping("/customGatherlistReturn")
public Gather customGatherlistReturn() {
return customGathersituation;
}