我做到了在此示例中显示的内容:http : //blog.springsource.com/2010/01/25/ajax-
simplifications-in-spring-3-0/
@RequestMapping(method=RequestMethod.POST)public @ResponseBody Map<String, ? extends Object> create(@RequestBody Account account, HttpServletResponse response) { Set<ConstraintViolation<Account>> failures = validator.validate(account); if (!failures.isEmpty()) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return validationMessages(failures); } else { accounts.put(account.assignId(), account); return Collections.singletonMap("id", account.getId()); }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)