1

我在我的应用程序中使用prime faces数据表,我在数据表中有一个复选框列来选择某些行并将值发送到回bean但它总是传递空值,任何人都可以建议我的代码有什么问题

 <p:dataTable id="tblStatusSearch" var="item"
      selection="#{StatusAction.listBEeans}" 
        value="#{bondLocationStatusAction.listLocationEBeans}"
     rowKey="#{item.LocationId}">
         <p:column selectionMode="multiple"/>

背豆:

private List<LocationEBean> listBEeans;

public List<LocationEBean> getListBEeans() {
    return listBEeans;
}

public void setListBEeans(List<LocationEBean> listBEeans) {
    this.listBEeans = listBEeans;
}
public void ReSend(){

  listBEeans=new ArrayList<LocationEBean>();
  System.out.println("listBEans:"+listBEeans);
  msgProcBusServ.reSendMsg(listBEeans);

}

错误日志

INFO: java.lang.NullPointerException
java.lang.NullPointerException
    at java.lang.reflect.Array.newArray(Native Method)
    at java.lang.reflect.Array.newInstance(Array.java:52)
    at org.primefaces.component.datatable.DataHelper.decodeMultipleSelection(DataHelper.java:268)
    at org.primefaces.component.datatable.DataHelper.decodeSelection(DataHelper.java:240)
    at org.primefaces.component.datatable.DataTableRenderer.decode(DataTableRenderer.java:72)
    at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:787)
    at javax.faces.component.UIData.processDecodes(UIData.java:1162)
    at org.primefaces.component.datatable.DataTable.processDecodes(DataTable.java:554)
    at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:506)
    at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
    at javax.faces.component.UIData.visitTree(UIData.java:1411)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
    at javax.faces.component.UIForm.visitTree(UIForm.java:371)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
    at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:376)
    at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:252)
    at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:183)
    at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:183)
    at org.openfaces.ajax.PartialViewContext.processPartial(PartialViewContext.java:131)
    at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:183)
    at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931)
    at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:349)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:66
4

1 回答 1

3

INMOselection应该指向一个数组而不是数组列表

尝试制作listBEean这样的数组

private LocationEBean[] listBEeans;

看看展示柜

DataTable - 多行选择

于 2012-08-26T08:15:57.347 回答