Hello,
I am trying to achieve the following:
- populate a single-select dropdown or a radio button group with all possible values of an Enum.
- Bind the value of the component to a Java bean proptery of type Enum.
This code is used to populate the dropdown:
public List<SelectItem> getQuotationTypeItems() {
QuotationTypeEnum[] values = QuotationTypeEnum.values();
List<SelectItem> list = new ArrayList<SelectItem>(values.length);
for (QuotationTypeEnum value : values) {
list.add(new SelectItem(value.name(), value.getDisplayValue()));
}
return list;
}
The getters and setters of the property the component is bound to are as follows:
public QuotationTypeEnum getQuoteType() {
return this.quoteType;
}
public void setQuoteType(QuotationTypeEnum quoteType) {
this.quoteType = quoteType;
}
where QuotationTypeEnum is a java enum.
The dropdown is populated correctly but the selected value is not bound. I receive the error message: {0}: Validation Error: Value is not valid
Is CAF not supporting converting enums - that would be strange because JSF supports enum conversion out of the box.
Any help is appreciated.
Regards,
Mathias