数据模型
package com.foo.bar.baz.model
class Customer {
Integer id
String firstName
String lastName
.....
}
普惠制
....
<f:with bean="Customer">
<f:field property="firstName"/>
</f:with>
....
GSP 不在views\customer 目录中,而是在views\customerRegistration 中。当我尝试查看我得到的页面时:
URI /myApp/customerRegistration/index Class org.springframework.beans.NotReadablePropertyException Message Invalid property 'firstName' of bean class [java.lang.String]: Bean property 'firstName' is not read or has an invalid getter method: 是否返回getter 的类型是否匹配 setter 的参数类型?
为什么它不能读取我的数据对象中的 firstName 字段?
我尝试在标记(“bean="com.foo.bar.baz.model.Customer")中添加完整包,它只会将上述错误消息中的“bean 类”从 java.lang.String 更改为 java .lang.Class