@RequestMapping(value = "/update") @ResponseBody public String update( @ModelAttribute User user, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { userService.update(user); String id = user.getId(); return id; }
@RequestMapping(value = "updateForm") public String update( @Valid User user, BindingResult result, Model uiModel, HttpServletRequest httpServletRequest) { uiModel.asMap().clear(); userService.update(user); populateEditForm(uiModel, user); return "redirect:edit/" + encodeUrlPathSegment(user.getId().toString(), httpServletRequest); }