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

时间:2017-12-15 12:02:21

标签: jsf primefaces autocomplete

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

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

2 个答案:

答案 0 :(得分:0)

如果从完整方法

返回null值,则可能发生这种情况

答案 1 :(得分:0)

如果自动完成功能位于 masterdetail 中且其禁用的属性发生更改,也会发生这种情况。