I'm using Spring mvc 3 and I'd like to format a field. Per a suggestion I'd like to move it to a p开发者_Python百科roperty editor.
However it doesn't seem to be applied. I did:
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(String.class, "mobileNumber", new MobileNumberEditor(false));
}
Where mobileNumber is a variable of my User object. I've also tried user.mobileNumber but that doesn't seem to work either?
I could probably register (User.class,new UserEditor(false)) but that seems to be a bit of a roundabout way.
精彩评论