使用PrimeFaces自动完成获取nullpointer异常

问题描述 投票:0回答:1

自动填充主要问题有问题。当我选择任何一个自动完成标记时,第一次它没有任何问题。但是当我第二次选择它时会抛出错误。

SEVERE: Error during partial-page rendering
java.lang.NullPointerException
    at org.primefaces.component.autocomplete.AutoCompleteRenderer.encodeSuggestionsAsList(AutoCompleteRenderer.java:491)
    at org.primefaces.component.autocomplete.AutoCompleteRenderer.encodeSuggestions(AutoCompleteRenderer.java:393)
    at org.primefaces.component.autocomplete.AutoCompleteRenderer.encodeResults(AutoCompleteRenderer.java:123)
    at org.primefaces.component.autocomplete.AutoCompleteRenderer.encodeEnd(AutoCompleteRenderer.java:105)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:580)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:762)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer$EncodeAllCallback.visit(PanelPartialRootRenderer.java:231)
    at org.apache.myfaces.trinidadinternal.renderkit.core.ppr.PartialPageContextImpl$PartialPageVisitContext.invokeVisitCallback(PartialPageContextImpl.java:398)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:924)
    at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1073)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:952)
    at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1073)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:952)
    at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1073)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:952)
    at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1073)
    at org.apache.myfaces.trinidad.render.CoreRenderer.visitChildrenForEncoding(CoreRenderer.java:228)

下面是代码

<tr:inputDate id="endDate" value="#{projectMgdBean.addProject.end_Date }" required="true" requiredMessageDetail="end Date Missing"/>
<tr:outputLabel value="Test Efforts:" for="efforts"/>
<tr:inputText id="efforts" value="#{projectMgdBean.addProject.efforts }" required="false" requiredMessageDetail="end Date Missing"/>
<p:outputLabel id="countryLabel" value="Tester: " />
<h:panelGroup>
<h:panelGrid>
<p:autoComplete id="tester1" vallue="#{projectMgdBean.addProject.tester1}" completeMethod="#{projectMgdBean.getEmails()}" cache="true"/>
<p:autoComplete id="tester2" vallue="#{projectMgdBean.addProject.tester2}" completeMethod="#{projectMgdBean.getEmails1()}"/>
<p:autoComplete id="tester3" vallue="#{projectMgdBean.addProject.tester3}" completeMethod="#{projectMgdBean.getEmails2()}" />
</h:panelGrid>
</h:panelGroup>
</h:panelGrid>  

我正在使用JSF 1.2和primeFaces 5.0

jsf primefaces autocomplete
1个回答
0
投票

如果从完整方法返回null值,则可能发生这种情况

© www.soinside.com 2019 - 2024. All rights reserved.