示例#1
0
 @RequestMapping(value = "/login", method = RequestMethod.POST)
 public String login(String userId, String password, HttpSession session) {
   try {
     userService.login(userId, password);
     session.setAttribute("user", userService.findUser(userId));
   } catch (PasswordMismatchException e) {
     return "user/login";
   }
   return "redirect:/";
 }
示例#2
0
 @RequestMapping(value = "", method = RequestMethod.POST)
 public String create(User user, Model model) {
   try {
     userService.create(user);
   } catch (ExistedUserException e) {
   }
   return "redirect:user";
 }
示例#3
0
 @RequestMapping(value = "", method = RequestMethod.PUT)
 public String update(User user, Model model) {
   userService.update(user);
   return "redirect:user";
 }
示例#4
0
 @RequestMapping("/{userId}/form")
 public String updateForm(@PathVariable String userId, Model model) {
   model.addAttribute("user", userService.findUser(userId));
   return "user/form";
 }
示例#5
0
 @RequestMapping("")
 public String index(Model model) {
   model.addAttribute("users", userService.finds());
   return "user/index";
 }