我在jsp 页面中通过 Post 方式 将 数据 传送给后台 执行action方法
我debug 看了下 action 执行到 return “success”; hibernate 会持续查询很多 数据 然后 再 执行我 jsp 页面中 alert();方法
很奇怪。。不明白是什么原因
jsp 页面的 post
$.post(
"finishShouHuo.action?dt="+new Date().getTime(),
{"cgwlid":cgwlid,"shrq":shrq,"gmsl":gmsl,"price":price,"gysid":gysid},
function(data){
if(data.ok){
// top.Dialog.alert("申请成功!请耐心等待。");
alert("收货成功,等待质检!");
top.Dialog.close();
// diag.close();
// history.go(0);
}else{
top.Dialog.alert("系统故障!");
}
},
"json"
);
Action 的 execute 方法
public String execute(){
//是否登录
user=(User) session.get("user");
if(null==user){
ok=false;
}else{
try {
cgwl=caiGouWuLiaoDAO.findById(cgwlid);
CaiGouShiJiMingXi cgsjmx=new CaiGouShiJiMingXi();
cgsjmx.setCaiGouWuLiao(cgwl);
cgsjmx.setNum(gmsl);
if(!"".equals(shrq)){
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Timestamp dd;
dd = new Timestamp(format.parse(shrq).getTime());
cgsjmx.setDaoHuoRiQi(dd);
}else{
Timestamp dd;
Date d=new Date();
dd=new Timestamp(d.getTime());
cgsjmx.setDaoHuoRiQi(dd);
}
ZiDian_CaiGouZhuangTai cgzt=new ZiDian_CaiGouZhuangTai();
//此采购明细为 已收货
cgzt=ziDian_CaigouZhuangTaiDAO.yiShouHuo();
cgsjmx.setCaiGouZhuangTai(cgzt);
cgsjmx.setShouHuoYuan(user);
cgsjmx.setPrice(new Double(price));
wlgys=wuLiaoGongYingShangDAO.findById(gysid);
cgsjmx.setWuLiaoGongYingShang(wlgys);
//保存此采购明细
caiGouShiJiMingXiDAO.save(cgsjmx);
ok=true;
} catch (Exception e) {
ok=false;
e.printStackTrace();
}
}
return "success";
配置文件
<!-- 完成收货 -->
<action name="finishShouHuo" class="finishShouHuoAction">
<result name="success" type="json"></result>
</action>
配图。。 如果我再执行 一步 就会出现很多查询语句。。很多时候 会出异常。。