@RequestMapping(value = "/admin") public String showAdmin(Model model) { List<User> list = userService.getAllUsers(); model.addAttribute("users", list); return "admin"; }
@RequestMapping(value = "/createaccount", method = RequestMethod.POST) public String doCreate(@Validated(FrontEndValidator.class) User user, BindingResult result) { if (result.hasErrors()) { return "createuser"; } user.setEnabled(true); user.setAuthority("ROLE_USER"); if (userService.exists(user.getUsername())) { System.out.println("Caught user duplicate"); result.rejectValue( "username", "DuplicateKey.user.username", "This username is already registered"); return "createuser"; } userService.create(user); return "accountcreated"; }