关于Jsp页面的jstl标签的级联属性的异常。
2021-06-29 12:03
标签:ons asp map 异常 proc post java setattr invalid 使用SpringMVC框架时,当我做表单回显时。 情景描述。Employee 类有一个Department类的属性。这两各类存在多对一关联关系。 下面是Employee类的属性的定义。 下面是Employee类的属性的定义。 当我在添加Employee 对象的页面做部门信息的表单回显时。相关的jsp页面如下。 在上述jsp页面的代码中,如果把注释里的代码跟注释外面的代码换一下就会出现异常。NotReadablePropertyException 异常如下: 关于Jsp页面的jstl标签的级联属性的异常。 标签:ons asp map 异常 proc post java setattr invalid 原文地址:http://www.cnblogs.com/GooPolaris/p/7141355.htmlpublic class Employee
{
private Integer id;
private String name;
private String email;
private int gender;
private Department department;
}
public class Department
{
private Integer id;
private String departmentName;
}
form:form action="input" method="POST" modelAttribute="employee">
Name: form:input path="name"/>
br>
Email: form:input path="email"/>
br>
%
Map
org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/views/input.jsp at line 39
36: Department: form:select path="department.id" items="${departments}"
37: itemLabel="department.departmentName" itemValue="department.id">form:select>
38: --%>
39: Department: form:select path="department.id" items="${departments}"
40: itemLabel="department.departmentName" itemValue="department.id">form:select>
41: br>
42: input type="submit" name="Submit">
org.springframework.beans.NotReadablePropertyException: Invalid property ‘department‘ of bean class [com.zcd.ssh.beans.Department]: Bean property ‘department‘ is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyValue(AbstractNestablePropertyAccessor.java:633)
org.springframework.beans.AbstractNestablePropertyAccessor.getNestedPropertyAccessor(AbstractNestablePropertyAccessor.java:850)
org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyAccessorForPropertyPath(AbstractNestablePropertyAccessor.java:827)
org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyValue(AbstractNestablePropertyAccessor.java:622)
org.springframework.web.servlet.tags.form.OptionWriter.doRenderFromCollection(OptionWriter.java:202)
org.springframework.web.servlet.tags.form.OptionWriter.renderFromCollection(OptionWriter.java:180)
org.springframework.web.servlet.tags.form.OptionWriter.writeOptions(OptionWriter.java:133)
下一篇:webpack入门