@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 20:41:16 浏览: 283
这段代码是一个 Java Spring MVC 的 Controller 中的方法,对应的请求路径是 "/shenqingupdate"。这个方法会接收前端传来的表单数据,将其填充到一个 Shenqing 实体类中,然后通过调用 service.update(post) 方法将其更新到数据库中。最后会返回一个保存成功的提示,并跳转到前端提交的 referer 页面。如果是 Ajax 请求,则会返回一个 JSON 格式的结果。
阅读全文
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![docx](https://img-home.csdnimg.cn/images/20241231044901.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/20241231045053.png)