1)转发 (默认)
return "逻辑视图";
2)重定向
return "redirect:地址" //到请求地址.
1 @RequestMapping("/modify/{id}") 2 public String getUserById(@PathVariable String id,Model model) 3 throws ServletException, IOException { 4 User user = userService.getUserById(id); 5 model.addAttribute("user", user); 6 return "usermodify"; 7 } 8 9 @RequestMapping("/modifyexe") 10 public String modify(User user,HttpSession session) 11 throws ServletException, IOException { 12 user.setModifyBy(((User)session.getAttribute(Constants.USER_SESSION)).getId()); 13 user.setModifyDate(new Date()); 14 if(userService.modify(user)){ 15 return "redirect:query"; 16 }else{ 17 return "usermodify"; 18 } 19 }