SpringMVC提供一个优雅的后台重定向方式:RedirectView
在需要封装数据,并进行重定向的场景使用它在适合不过了;
-
-
-
-
@RequestMapping(value = "postPayAmount", method = RequestMethod.GET)
-
public RedirectView postPayAmount(HttpSession session,ModelMap map) {
-
return new RedirectView(WsUrlConf.URI_PAY,true,false,false);
-
}
而ModelAndView又可以封装RedirectView进行使用,用起来酸爽得很~~
常见用法:
-
return new ModelAndView(new RedirectView("xxx.do"), map);
最后,附上一下SpringMVC执行流程图:

SpringMVC使用RedirectView进行POST重定向
原文:http://blog.csdn.net/oydaybreak/article/details/45094011