/** * 保存 * * @param domain * @param result * @return * @throws Exception */ @RequestMapping("/save") @ResponseBody public String doSave(@Valid @ModelAttribute("domain") CollegeDomain domain, BindingResult result) throws Exception { if (result.hasErrors()) { // 如果校验失败,则返回 return Consts.ERROR; } else { if (collegeService.doSave(domain)) { return Consts.SUCCESS; } } return Consts.ERROR; }