@InitBinder public void initBinder(WebDataBinder binder) { binder.setDisallowedFields(new String[] {"studentMobile"}); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy****mm****dd"); binder.registerCustomEditor(Date.class, "studentDOB", new CustomDateEditor(dateFormat, false)); binder.registerCustomEditor(String.class, "studentName", new StudentNameEditor()); }
/** * For some security. Defines which fields can be bound (whitelist), and which ones cannot. * * <p>Also adds validation that spans more than one field * * @param binder */ @InitBinder public void initialiseBinder(WebDataBinder binder) { binder.setDisallowedFields("unitsOnOrder", "discontinued"); binder.setAllowedFields( "productId", "name", "unitPrice", "description", "manufacturer", "category", "unitsInStock", "condition", "productImage", "productManual", "language"); // binder.addValidators(productValidator); binder.setValidator(productValidator); }
@InitBinder public void initBinder(WebDataBinder binder) { binder.setDisallowedFields("id"); binder.setValidator(new MyClass112Validator()); }
@InitBinder public void initBinder(WebDataBinder dataBinder) { dataBinder.setDisallowedFields("id"); }
@InitBinder public void initBinderFirstParam(WebDataBinder dataBinder) { dataBinder.setAllowedFields("allowed1", "allowed2"); dataBinder.setRequiredFields("required1", "required2"); dataBinder.setDisallowedFields("disAllowed1", "disAllowed2"); }
@InitBinder("user4") public void initBinder4(WebDataBinder binder) { binder.setFieldDefaultPrefix("user4."); binder.setDisallowedFields("id"); }