primefaces 3.3.1数据表多重选择不起作用

时间:2012-08-26 03:23:30

标签: jsf datatable primefaces

我正在我的应用程序中使用prime faces数据表,其中我在datatable中有一个checkbox列来选择某些行并将值发送到back bean但是它总是传递null值,任何人都可以建议我的代码有什么问题< / p>

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

BackBean:

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);

}

Errr Log

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

1 个答案:

答案 0 :(得分:3)

INMO selection应该指向数组而不是数组列表

尝试使listBEean像这样的数组

private LocationEBean[] listBEeans;

看一下展示

DataTable - Multiple Row Selection