List of usage examples for org.springframework.validation BindingResult getErrorCount
int getErrorCount();
From source file:org.springframework.web.servlet.mvc.generic.GenericFormController.java
/** * This implementation calls {@link #showForm} in case of errors, * and delegates to {@link #onSubmit}'s variant else. * <p>This can only be overridden to check for an action that should be executed * without respect to binding errors, like a cancel action. To just handle successful * submissions without binding errors, override the {@link #onSubmit} method. * @see #showForm//from w ww . j av a 2 s. c om * @see #onSubmit */ protected ModelAndView processFormSubmission(HttpServletRequest request, T formObject, BindingResult bindingResult) throws Exception { if (bindingResult.hasErrors()) { if (logger.isDebugEnabled()) { logger.debug("Data binding errors: " + bindingResult.getErrorCount()); } return showForm(request, bindingResult); } else { logger.debug("No errors -> processing submit"); ModelAndView mav = onSubmit(request, formObject, bindingResult); if (mav != null) { return mav; } else { return showForm(request, bindingResult); } } }