選項項目的錯誤枚舉被定義爲:爲什麼會使用此枚舉在JSTL
public enum Country {
US("United States"),
CA("Canada"),
AUS("Australia");
private String fullName;
private Country(String fullName) {
this.fullName = fullName;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
}
的型號是:
public class Workspace implements Serializable {
// ...
@Valid
@NotNull
private Address address;
//...
}
public class Address implements Serializable {
// ...
private Country country;
//...
}
我有一個視圖對象爲這樣的:
public class WorkspaceVO implements Serializable {
//..
private Workspace workspace;
//...
}
最後,在我的jsp我試圖做的事:
<form:select id="country" path="workspace.address.country">
<form:options items="${workspace.address.country}" itemLabel="fullName"/>
</form:select>
我有這種確切的情況在我的代碼中的其他地方重複,並且工作正常。我沒有看到任何區別,但是,當我訪問jsp時出現錯誤...
javax.servlet.jsp.JspException:類型[com.mycompany.web.Country]無效選項
任何想法爲什麼?
這是否幫助? http://stackoverflow.com/questions/6014280/select-in-spring-mvc-by-enum – MarkOfHall