开发者

Questions about property editor (customEditor) not being applied?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜