To implement page redirection with Flash-scoped objects, apply these steps:
- To start our experiment on implementing page redirection, let us create a controller that loads a login form, processes the username and password, and then redirects to another form controller through Spring's old way of page navigation, that is, through RedirectView:
@Controller public class RedirectPageController { @RequestMapping(value="/login.html", method=RequestMethod.GET) public String login(){ return "login"; } @RequestMapping(value="/jump_page.html", method=RequestMethod.POST) public RedirectView sendRedirection(RedirectAttributes atts, @RequestParam("username") String username, @RequestParam("password") String password){ atts.addFlashAttribute("username", ...