From spring doc about redirecting:
After redirect, how can I add attributes from HTTP query parameters to ModelMap? Can I avoid adding attributes manually ?All model attributes are exposed as HTTP query parameters
Thanks,Code:@Controller class SomeController { @RequestMapping(value = "/test_path", method = RequestMethod.POST) public String doPost(ModelMap modelMap) { modelMap.put("message", "OK"); return "redirect:/test_path"; //redirect to /test_path?message=OK } @RequestMapping(value = "/test_path", method = RequestMethod.GET) public String doGet(ModelMap modelMap) { // PROBLEM: After redirect from POST request, // I would like modelMap to have the same attributes as they were set in POST request. } }
Jarek


Reply With Quote