I want to trim all string fields with a form string automatically (only for trailing and leading spaces)
Suppose if I pass FirstName = "robert" Expected: "robert"
A controller class that has the following code:
@InitBinder public void initBinder ( WebDataBinder binder ) { StringTrimmerEditor stringtrimmer = new StringTrimmerEditor(true); binder.registerCustomEditor(String.class, stringtrimmer); } @RequestMapping(value = "/createuser", method = RequestMethod.POST) public Boolean createUser(@RequestBody UserAddUpdateParam userAddUpdateParam) throws Exception { return userFacade.createUser(userAddUpdateParam); }
when I debug the code, it goes into @InitBinder but does not crop the fields of the bean line.
source share