Exemplo n.º 1
0
 @RequestMapping(value = {"/", "/listUsers"})
 public String listUsers(Map<String, Object> map) {
   if (pagedListHolder == null) {
     pagedListHolder = new PagedListHolder(userService.listUsers(search));
     pagedListHolder.setPage(0);
     pagedListHolder.setPageSize(3);
   }
   map.put("user", new User());
   map.put("userList", pagedListHolder);
   map.put("search", search);
   return "/users/listUsers";
 }
Exemplo n.º 2
0
 @RequestMapping(value = "/search")
 public String searchUsers(@RequestParam(required = false, defaultValue = "") String name) {
   search = name.trim();
   pagedListHolder.setSource(userService.listUsers(search));
   return "redirect:/users/listUsers";
 }
Exemplo n.º 3
0
 @RequestMapping(value = "/delete/{userId}")
 public String deleteUser(@PathVariable Long userId) {
   userService.deleteUser(userId);
   pagedListHolder.setSource(userService.listUsers(search));
   return "redirect:/users/listUsers";
 }
Exemplo n.º 4
0
 @RequestMapping(value = "/get/{userId}")
 public String getUser(@PathVariable Long userId, Map<String, Object> map) {
   User user = userService.getUser(userId);
   map.put("user", user);
   return "/users/userForm";
 }
Exemplo n.º 5
0
 @RequestMapping(value = "/save", method = RequestMethod.POST)
 public String saveUser(@ModelAttribute("user") User user, BindingResult result) {
   userService.saveUser(user);
   pagedListHolder.setSource(userService.listUsers(search));
   return "redirect:/users/listUsers";
 }