@RequestMapping("/shenqingupdate") public String update() { _var = new LinkedHashMap(); // 重置数据 // 创建实体类 Shenqing post = new Shenqing(); // 将前台表单数据填充到实体类 if (!Request.get("biaoti").equals("")) post.setBiaoti(Request.get("biaoti")); if (!Request.get("wuziid").equals("")) post.setWuziid(Request.getInt("wuziid")); if (!Request.get("bianhao").equals("")) post.setBianhao(Request.get("bianhao")); if (!Request.get("leixing").equals("")) post.setLeixing(Request.get("leixing")); if (!Request.get("mingcheng").equals("")) post.setMingcheng(Request.get("mingcheng")); if (!Request.get("shuliang").equals("")) post.setShuliang(Request.getInt("shuliang")); if (!Request.get("shenqingren").equals("")) post.setShenqingren(Request.get("shenqingren")); if (!Request.get("addtime").equals("")) post.setAddtime(Request.get("addtime")); if (!Request.get("zhuangtai").equals("")) post.setZhuangtai(Request.get("zhuangtai")); post.setId(Request.getInt("id")); service.update(post); // 更新数据 int charuid = post.getId().intValue(); if (isAjax()) { return jsonResult(post); } return showSuccess("保存成功", Request.get("referer")); // 弹出保存成功,并跳转到前台提交的 referer 页面 }
时间: 2023-12-06 11:41:17 浏览: 147
这段代码是一个Java Spring框架中的控制器方法,用于处理用户提交的表单数据并进行更新操作。具体地,该方法首先创建一个名为post的Shenqing实体类,并将从前端表单中获取到的数据填充到该实体类中。然后,通过调用service.update(post)方法,将更新后的数据更新到数据库中。最后,如果是Ajax请求,则返回JSON格式的结果,否则返回一个包含“保存成功”消息并跳转到前台提交的referer页面的成功提示页面。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044833.png)
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![docx](https://img-home.csdnimg.cn/images/20241231044901.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20250102104920.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)