【发布时间】:2012-03-29 14:34:42
【问题描述】:
我正在尝试使用 <form:select> 标记在我的编辑内容 .jsp 中使用以下 ENUM,但找不到有关如何执行此操作的示例。
public class Content implements Serializable {
public enum Paperless {
NONE(null, ""),
EDELIVERY_RECOMMENDED("EDELIVERY_RECOMMENDED", "Recommend eDelivery"),
EDELIVERY_REQUIRED("EDELIVERY_REQUIRED", "Require eDelivery"),
EDELIVERY_REQUIRED_JUSTIFICATION("EDELIVERY_REQUIRED_JUSTIFICATION", "Require eDelivery w/out justification");
private String name;
private String description;
Paperless(String name, String description) {
this.name = name;
this.description = description;
}
public String getName() {
return this.name;
}
public String getDescription() {
return this.description;
}
}
....
上面的内容对象作为${content}传递给我的.jsp文件。
我正在努力
<form:select path="content.Paperless">
<form:options items="${content.Paperless}" itemLabel="name"/>
</form:select>
它正在抛出异常......
org.springframework.beans.NotReadablePropertyException: Invalid property 'content' of bean class [com.fettergroup.cmt.model.Content]: Bean property 'content' is not readable or has an invalid getter method: Does the return type of the getter match the parameter
我对此有一些误解,但我无法确定是哪一个......
【问题讨论】:
-
Content中的List<Paperless> getPaperlessOptions()方法怎么样?这将要求您在页面中写items="${content.paperlessOptions}"。
标签: java spring-mvc taglib