Custom property editors do not work for request parameters in Spring MVC?

前端 未结 1 1822
暖寄归人
暖寄归人 2021-01-03 08:23

I\'m trying to create a multiaction web controller using Spring annotations. This controller will be responsible for adding and removing user profiles and preparing referenc

相关标签:
1条回答
  • 2021-01-03 09:09

    I don't think you want to be specifying the field argument to WebDataBinder.registerCustomEditor(). This intended to work alongside form-backing objects, and you're not using that.

    Try the simpler 2-arg method instead, and it should work:

    binder.registerCustomEditor(UserAccount.class, new UserAccountPropertyEditor(userManager)); 
    binder.registerCustomEditor(Profile.class, new ProfilePropertyEditor(profileManager));
    
    0 讨论(0)
提交回复
热议问题