简体   繁体   中英

List in omnifaces.ListConverter is not set

I'm developing a JSF Application with PrimeFaces.

For a Picklist I'm trying to use the omnifaces.ListConverter but the list property in this converter is not set.

reporting-edit.xhtml

<p:pickList id="picklist_columns" value="#{reportingEditView.columns}" var="repcolumn"
        itemLabel="#{repcolumn.column.name}" itemValue="#{repcolumn}" responsive="true"
        showSourceFilter="true" filterMatchMode="contains">
<o:converter converterId="benni.ListConverter" list="#{reportingEditView.columns.source}"/>
<f:facet name="targetCaption">Spalten</f:facet>
<p:ajax event="transfer" listener="#{reportingEditView.handleColumnTransfer}"/>

reportingEditView.java

@ManagedBean
@SessionScope

public class ReportingEditView

{
    private DualListModel<RepColumn> columns;

    public void initPickList()
    {
        List<RepColumn> availableColumns = new ArrayList<>();
        List<RepColumn> selectedColumns = new ArrayList<>();

        ... populate availableColumns and selectedColumns ...

        this.columns = new DualListModel<RepColumn>();
        this.columns.setSource(availableColumns);
        this.columns.setTarget(selectedColumns);
    }
}

All the columns are displayed in my PickList but when I put one column from the source list into the target list a NullPointer is thrown because the list in the converter is not set.

Also the listener Method is not called when transferring an element in the PickList.

Any ideas what I am doing wrong?

Shame on me!

I fixed that issue. I don't know how but there was xmlns:o="http://java.sun.com/jsf/core" in my reporting-edit.xhtml. After replacing that with xmlns:o="http://omnifaces.org/ui" everything works like a charm.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM