java。 primefaces datatable - 多个选择 - 动作后的空指针 - decodeMultipleSelection

时间:2013-09-23 10:55:25

标签: java primefaces datatable

这是代码的一部分

<p:dataTable styleClass="sectionTable" id="licenseslist" var="item" 
    value="#{licenseController.items}" paginator="true" rows="10" 
    emptyMessage="empty" rowsPerPageTemplate="10,20,50,100" lazy="true" 
    paginatorAlwaysVisible="false" paginatorTemplate="{RowsPerPageDropdown}
    {FirstPageLink} {PreviousPageLink} {CurrentPageReport} 
    {NextPageLink} {LastPageLink}" >  

    <p:column selectionMode="multiple" style="width:2%" disabledSelection="#{item.bisPurchaseExpired()}"/>

    <p:column  styleClass="td_name"  headerText="{bundle.memoq_licenses_table_head_display_name}">
        <h:outputText value="#{item.productVersion.product.displayName}" />
    </p:column>

    // more table data...

    <f:facet name="footer">  
             <h:commandLink id="submit" action="#{licenseController.pay()}" styleClass="button  button_black button_fieldValue">
             <span class="button_start"/>
             <h:outputText value="checkout" styleClass="button_end"/>
        </h:commandLink>>
    </f:facet>
</p:dataTable>

如果我点击链接:

javax.servlet.ServletException
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:137)
org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
hu.weblib.kilgray.ev.CharEncodingFilter.doFilter(CharEncodingFilter.java:52)

root cause

java.lang.NullPointerException
org.primefaces.component.datatable.feature.SelectionFeature.decodeMultipleSelection(SelectionFeature.java:50)
org.primefaces.component.datatable.feature.SelectionFeature.decode(SelectionFeature.java:39)
org.primefaces.component.datatable.DataTableRenderer.decode(DataTableRenderer.java:53)
javax.faces.component.UIComponentBase.decode(UIComponentBase.java:787)
org.primefaces.component.api.UIData.processDecodes(UIData.java:224)
javax.faces.component.UIForm.processDecodes(UIForm.java:225)
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:933)
com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:137)
org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
hu.weblib.kilgray.ev.CharEncodingFilter.doFilter(CharEncodingFilter.java:52)

如果我放下多个部分,它就可以了。 也许是缺少的东西...但我没有线索,是什么..

(getRowKey在lazymodell中定义) 我尝试了这个建议:selectionMode on primefaces dataTable - &gt;没有工作

1 个答案:

答案 0 :(得分:0)

getRowData中缺少lazymodel方法,在实现此方法后,该功能就像魅力一样。