如何在Spring MVC 3.1中重定向后读取flash属性?
- 论坛
- 如何在Spring MVC 3.1中重定向后读取flash属性?
10 浏览
如何在Spring MVC 3.1中重定向后读取flash属性?
我想知道如何在Spring MVC 3.1中的重定向后读取flash属性。
我有以下的代码:
@Controller
@RequestMapping("/foo")
public class FooController {
@RequestMapping(value = "/bar", method = RequestMethod.GET)
public ModelAndView handleGet(...) {
// 我想在这里看到我的flash属性!
}
@RequestMapping(value = "/bar", method = RequestMethod.POST)
public ModelAndView handlePost(RedirectAttributes redirectAttrs) {
redirectAttrs.addFlashAttributes("some", "thing");
return new ModelAndView().setViewName("redirect:/foo/bar");
}
}
我错过了什么吗?