List of usage examples for org.springframework.web.bind WebDataBinder setValidator
public void setValidator(@Nullable Validator validator)
From source file:co.adun.mvnejb3jpa.web.controller.InitiateLeadController.java
@InitBinder protected void initBinder(WebDataBinder binder) { binder.setValidator(validator); }
From source file:org.opentides.web.controller.BaseCrudController.java
/** * Method that attaches the autowired form validator to the binder * /*from w w w . ja v a 2 s . c o m*/ * @param binder */ @InitBinder protected void attachValidator(WebDataBinder binder) throws Exception { if ((formValidator != null) && (binder.getTarget() != null) && formValidator.supports(binder.getTarget().getClass())) binder.setValidator(formValidator); }
From source file:au.org.ala.biocache.web.OccurrenceController.java
/** * Need to initialise the validator to be used otherwise the @Valid annotation will not work * @param binder// w ww .jav a 2 s. c om */ @InitBinder protected void initBinder(WebDataBinder binder) { binder.setValidator(validator); }
From source file:org.craftercms.studio.controller.services.rest.DependencyController.java
@InitBinder protected void initBinder(WebDataBinder binder) { binder.setValidator(new Validator() { @Override/*from w w w . j a v a 2 s.c o m*/ public boolean supports(final Class<?> clazz) { return String.class.equals(clazz); } @Override public void validate(final Object o, final Errors errors) { if (o instanceof String) { if (StringUtils.isEmpty((String) o)) { errors.reject((String) o, "Request body can not be empty"); } } } }); }
From source file:org.mifos.ui.core.controller.DefineNewHolidayController.java
@InitBinder protected void initBinder(WebDataBinder binder) { binder.setValidator(new HolidayFormValidator()); }
From source file:org.mifos.ui.core.controller.DefineNewPenaltyController.java
@InitBinder protected void initBinder(WebDataBinder binder, HttpSession session) { binder.setValidator( new PenaltyFormValidator(viewOrganizationSettingsServiceFacade.getOrganizationSettings(session))); }
From source file:org.mifos.ui.core.controller.DefineSavingsProductsFormController.java
@InitBinder protected void initBinder(WebDataBinder binder) { LazyBindingErrorProcessor errorProcessor = new LazyBindingErrorProcessor(); binder.setValidator(new SavingsProductFormValidator(errorProcessor, configurationServiceFacade)); binder.setBindingErrorProcessor(errorProcessor); }