我对WebArgumentResolver有疑问。我将属性emailSetting添加到用户域类
EmailSetting emailSetting = new EmailSetting()
为它上课:
class EmailSetting {
boolean newsletter = true
boolean mayorships = true
boolean comments = true
}
现在我想编辑/更新这些设置并在UserService中为其指定参数:
user.emailSetting = new EmailSetting(params.emailSetting)
params来自edit.gsp中的一个表单,名为
emailSetting.comments
emailSetting.mayorships
emailSetting.newsletter
我期望WebArgumentResolver做的是分配值。但也许因为它有一个层次的间接。记录参数显示:
_emailSetting.mayorships:, emailSetting:[_comments:, _newsletter:, newsletter:on, _mayorships:, comments:on], emailSetting.newsletter:on, _emailSetting.comments:, email
错误消息为:No such property: _comments for class: com.shopotainment.util.EmailSetting
错误或可以更改以解决此问题?