我有一个枚举:
public enum Gender {
F("Female"),
M("Male"),
E("Either");
private final String description;
Gender(final String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}
消息属性:
StudyLevel.B=Begin (1-3 semesters)
StudyLevel.M=Middle (4-6 semesters)
StudyLevel.E=End (7 and more semesters)
一个豆子:
private Gender[] genders = Gender.values();
public Gender[] getGenders() {
return genders;
}
public void setGenders(Gender[] genders) {
this.genders = genders;
}
和我的xhtml文件:
<p:selectOneRadio id="gender" value="#{cc.attrs.offer.selectedGender}" required="true">
<f:selectItems value="#{offerBean.genders}" var="p" itemLabel="#{p.class.simpleName.concat('.').concat(p.name())}"/>
</p:selectOneRadio>
selectItems的输出文本是StudyLevel.B,StudyLevel.M和StudyLevel.E,但不是Begin(1-3个学期),依此类推。我怎么能正确地获取它?