/** 保存新增,@Valid标注spirng在绑定对象时自动为我们验证对象属性并存放errors在BindingResult */ @RequestMapping(method = RequestMethod.POST) public String create( ModelMap model, @Valid Comment comment, BindingResult errors, HttpServletRequest request, HttpServletResponse response) throws Exception { if (errors.hasErrors()) { return "/jtzs/comment/new"; } commentManager.save(comment); Flash.current().success(CREATED_SUCCESS); // 存放在Flash中的数据,在下一次http请求中仍然可以读取数据,error()用于显示错误消息 return LIST_ACTION; }