将 value 属性放入 selectOneMenu 时出现以下错误value="#{customer.customerType}"
:
javax.el.PropertyNotFoundException:目标无法到达,标识符“客户”解析为空
选择列表:
<p:pickList id="customersPL" itemLabel="#{customer.id}"
itemValue="#{customer}" responsive="true"
value="#{bean.customersList}" var="customer">
<o:converter converterId="omnifaces.ListConverter"
list="#{bean.customersListSource}" />
<p:ajax event="transfer" listener="#{bean.onTransfer}" />
<p:column>
<h:outputText value="#{customer.name}" />
</p:column>
<p:column>
<p:selectOneMenu converter="omnifaces.SelectItemsConverter"
id="customerType" value="#{customer.customerType}">
<f:selectItems itemLabel="#{customerType.name}"
itemValue="#{customerType}"
value="#{bean.customerTypesList}"
var="customerType" />
</p:selectOneMenu>
</p:column>
</p:pickList>
豆:
private CustomerType[] customerTypesList = CustomerType.values();
客户类型枚举:
public static enum CustomerType {
WHOLESALE("W", "Wholesale"), RETAIL("R", "Retail");
private String id;
private String name;
TipoCliente(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
}