标签:blog http 使用 io for ar 问题 div
转自:http://zghbwjl.blog.163.com/blog/static/12033667220137795252845/
return new ModelAndView("redirect:/toList");这样可以重定向到toList这个方法
public String save(@ModelAttribute("form") Bean form,RedirectAttributes attr)throws Exception {
String code = service.save(form);if(code.equals("000")){attr.addFlashAttribute("name", form.getName());attr.addFlashAttribute("success", "添加成功!");return "redirect:/index";}else{attr.addAttribute("projectName", form.getProjectName());attr.addAttribute("enviroment", form.getEnviroment());attr.addFlashAttribute("msg", "添加出错!错误码为:"+rsp.getCode().getCode()+",错误为:"+rsp.getCode().getName());return "redirect:/maintenance/toAddConfigCenter";}}
@RequestMapping("/index")
public String save(@ModelAttribute("form") Bean form,RedirectAttributes attr)throws Exception {return "redirect:/main/list";}页面取值不用我说了吧,直接用el表达式就能获得到,这里的原理是放到session中,session在跳到页面后马上移除对象。所以你刷新一下后这个值就会丢掉。
spring mvc controller间跳转 重定向 传参 (转),布布扣,bubuko.com
spring mvc controller间跳转 重定向 传参 (转)
标签:blog http 使用 io for ar 问题 div
原文地址:http://www.cnblogs.com/youngjoy/p/3919656.html