springMVC 重定向 传参数

接触SpringMVC不是很久,发现了一个好用的方法,重定向时可以通过一个Map传递给下一个控制器。

Map map= new HashMap();
map.put("userName", "yangjinde");
map.put("pwd", "yjd");
return new ModelAndView(new RedirectView("xxx.do"), map);
则在下个控制器里就可以用

String userName = request.getParameter("userName");取出数据,不过这还是get请求。

猜你喜欢

转载自tristan-s.iteye.com/blog/2195905
今日推荐