<Attribut> kann nicht aufgelöst werden, wie ein Mitglied der <bean>

Habe ich eine bean:

package controller.types;

import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class Test
{

    static List<MainTableRow> rows;

    public Test()
    {
        rows = new ArrayList<>();
    }

    public static List<MainTableRow> getRows()
    {
        return rows;
    }

    public static void setRows(List<MainTableRow> rows)
    {
        Test.rows = rows;
    }

}

Und meine xhtml-Seite ist:

    <h:form>
        <p:fileUpload
            fileUploadListener="#{fileUploadController.handleFileUpload}"
            mode="advanced" dragDropSupport="false" update="messages"
            sizeLimit="10000000" fileLimit="3" allowTypes="/(\.|\/)(xls)$/"  style="font-size: 14px"/>

        <p:growl id="messages" showDetail="true" />

        <p:dataTable id="dataTable" var="mainTableRow" value="#{test.rows}" style="font-size: 14px">
            <f:facet name="header">
            Main Table
        </f:facet>

            <p:column sortBy="" headerText="Index">
                <h:outputText value="#{mainTableRow.index}" />
            </p:column>
            <p:column sortBy="" headerText="Query">
                <h:outputText value="#{mainTableRow.index}" />
            </p:column>
            <p:column sortBy="" headerText="S1">
                <h:outputText value="#{mainTableRow.index}" />
            </p:column>
            <p:column sortBy="" headerText="S2">
                <h:outputText value="#{mainTableRow.index}" />
            </p:column>
            <p:column sortBy="" headerText="S3">
                <h:outputText value="#{mainTableRow.index}" />
            </p:column>
            <p:column sortBy="" headerText="S9">
                <h:outputText value="#{mainTableRow.index}" />
            </p:column>
            <p:column sortBy="" headerText="Uygunluk">
                <h:outputText value="#{mainTableRow.index}" />
            </p:column>
            <p:column sortBy="" headerText="Kural">
                <h:outputText value="#{mainTableRow.index}" />
            </p:column>
            <p:column sortBy="" headerText="Kaynak">
                <h:outputText value="#{mainTableRow.index}" />
            </p:column>
            <p:column sortBy="" headerText="Query Type">
                <h:outputText value="#{mainTableRow.index}" />
            </p:column>
            <p:column sortBy="" headerText="User Intent">
                <h:outputText value="#{mainTableRow.index}" />
            </p:column>

        </p:dataTable>

    </h:form>

In Zeile <p:dataTable id="dataTable" var="mainTableRow" value="#{test.rows}" style="font-size: 14px"> es gibt Fehler:

Zeilen können nicht aufgelöst werden, wie ein Mitglied des test -

Was ist der Grund?

  • Diese Methoden sind static. Sie sind nicht Mitglieder der Bohne. Stellen Sie die Instanz-Methoden oder überdenken Sie Ihre design, wenn Sie dies nicht tun können.
  • Vielen Dank, problem gelöst 🙂
InformationsquelleAutor yetAnotherSE | 2013-10-02
Schreibe einen Kommentar