1

将 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;
    }
}
4

1 回答 1

2

通常,选项列表不打算包含输入“控件”。因此,p:pickList从来没有设计成包含像h\p:selectonemenu或什至是简单的输入h\p:inputTexts。所以它不像你期望的那样工作,这很不幸。重新设计你的用户界面是唯一要做的事情。

于 2015-09-18T14:55:34.280 回答