我有一个豆子:
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;
}
}
我的 xhtml 页面是:
<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>
在行<p:dataTable id="dataTable" var="mainTableRow" value="#{test.rows}" style="font-size: 14px">
它给出错误:
行无法作为测试成员解析
是什么原因?