使用PrimeFaces自动完成获取nullpointer异常
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用PrimeFaces自动完成获取nullpointer异常相关的知识,希望对你有一定的参考价值。
自动填充主要问题有问题。当我选择任何一个自动完成标记时,第一次它没有任何问题。但是当我第二次选择它时会抛出错误。
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
答案
如果从完整方法返回null值,则可能发生这种情况
以上是关于使用PrimeFaces自动完成获取nullpointer异常的主要内容,如果未能解决你的问题,请参考以下文章
PrimeFaces自动完成多种样式但具有Multiple = false
Java PrimeFaces自动完成构面在分组时重复相同的组
捕获 primefaces <p:autoComplete> 更改事件(检测清空)
PrimeFaces Dropdown AutoComplete 内部复合组件