用户输入数据时以及注册之前如果他单击链接, 单击返回链接,用户输入的表单数据将丢失。
@SessionAttributes("user")
@Controller
public class UserController {
@Autowired
private UserService userService;
@RequestMapping(value="/",method=RequestMethod.GET)
public String registerPage(@ModelAttribute("user") User user, HttpServletRequest request, Model model){
System.out.println(request.getSession());
return "register";
}
@RequestMapping(value="/terms",method=RequestMethod.GET)
public String terms(@ModelAttribute("user") User user, HttpServletRequest request, Model model){
System.out.println(request.getSession());
return "terms";
}
}