How to use WebArgumentResolver for assigning params with level of indirection
I have a question about WebArgumentResolver. I added property emailSetting to user domain class,
EmailSetting emailSetting = new EmailSetting()
class for it:
class EmailSetting {
boolean newsletter = true
boolean mayorships = true
boolean comments = true
}
now I want to edit/update these settings and assign params to it in UserService:
user.emailSetting = new EmailSetting(params.emailSetting)
开发者_如何学Go
the params come from a form in edit.gsp and are named
emailSetting.comments
emailSetting.mayorships
emailSetting.newsletter
what I expect the WebArgumentResolver to do is assign the values. But maybe as it has one level of indirection. logging the params shows:
_emailSetting.mayorships:, emailSetting:[_comments:, _newsletter:, newsletter:on, _mayorships:, comments:on], emailSetting.newsletter:on, _emailSetting.comments:, email
error message is:No such property: _comments for class: com.shopotainment.util.EmailSetting
Whats wrong or could be changed to fix this?
精彩评论