@RequestMapping(value = "/modify/{userid}", method = RequestMethod.POST)
 public String modifyUser(
     @ModelAttribute("userBean") UserFormBean userBean,
     @PathVariable Integer userid,
     Model model) {
   User u = userService.getUserById(userid);
   userBean.setUserId(u.getUserId());
   userBean.setCreatedBy(u.getCreatedBy());
   userService.modifyUser(userFrom2user(u, userBean));
   return "redirect:/user";
 }
 @ResponseBody
 @RequestMapping(
     value = "/json/{userName}",
     method = RequestMethod.GET,
     produces = "application/json; charset=UTF-8")
 public String jsonGetUser(@PathVariable String userName) {
   String rc = serializationService.jsonSerialize(userService.getUserByName(userName));
   // System.out.println(rc);
   return rc;
 }
 @MenuItem
 @ResponseBody
 @RequestMapping(
     value = "/json",
     method = RequestMethod.GET,
     produces = "application/json; charset=UTF-8")
 public String jsonGetAll() {
   String rc = serializationService.jsonSerialize(userService.findAll());
   // System.out.println(rc);
   return rc;
 }
 @RequestMapping(value = "/modify/{userid}", method = RequestMethod.GET)
 public String modifyUser(@PathVariable Integer userid, Model model) {
   UserFormBean formBean = new UserFormBean();
   User user = userService.getUserById(userid);
   BeanUtils.copyProperties(user, formBean);
   if (user.getRoles() != null && user.getRoles().size() > 0) {
     Set<String> roleNames = new HashSet<String>();
     for (Role role : user.getRoles()) {
       roleNames.add(role.getRoleName());
     }
     formBean.setRoleNames(roleNames);
   }
   model.addAttribute("userBean", formBean);
   model.addAttribute("roles", roleService.findAll());
   return "user/modify";
 }
 @RequestMapping(value = "/add", method = RequestMethod.POST)
 public String addUser(@ModelAttribute("userBean") UserFormBean userBean, Model model) {
   User user = userFrom2user(new User(), userBean);
   userService.addUser(user);
   return "redirect:/user";
 }
 @MenuItem
 @RequestMapping(method = RequestMethod.GET)
 public String home(Model model) {
   model.addAttribute("userList", userService.findAll());
   return "user/home";
 }
 @RequestMapping(value = "/delete/{userid}", method = RequestMethod.DELETE)
 public String deleteUserViaREST(@PathVariable Integer userid) {
   userService.deleteUser(userService.getUserById(userid));
   return "redirect:/user";
 }
 @RequestMapping(value = "/delete", method = RequestMethod.GET)
 public String deleteUser(@RequestParam("userId") Integer userid) {
   userService.deleteUser(userService.getUserById(userid));
   return "redirect:/user";
 }