[英]Primefaces autocomplete error completeMethod
我有primefaces自動完成的問題。 jsf 頁面如下:
<h:inputText class="form-control" style="" for="villeRecherche"/>
<p:autoComplete id="villeRecherche"
value="#{rechercheRestoMb.selectedVille}"
completeMethod="#{rechercheRestoMb.completeVille}"
converter="convertisseurVille" var="c" itemLabel="#{c.ville}"
itemValue="#{c}" forceSelection="true" required="true" />
當 jsf 被調用時,我有這個服務器 500 錯誤:
javax.el.ELException: /corpsIndex.xhtml: The class 'fr.afcepf.al25.projetResto.managedBean.RechercheRestoMb' does not have the property 'completeVille'.
com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:94)
com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
我的 ManagedBean 是 RechercheRestoMb,它包含方法 completeVille
如果我使用 getter 和 setter 插入 public String completeVille 我沒有錯誤但自動完成不起作用。
有人對這個問題有想法嗎?
javax.el.ELException: /corpsIndex.xhtml: 類 'fr.afcepf.al25.projetResto.managedBean.RechercheRestoMb' 沒有屬性 'completeVille'。
此異常意味着 EL 表達式被解釋為屬性值表達式(需要 getter 方法),而不是方法表達式。 基本上,它找不到getCompleteVille()
方法。 然而,你實際上不應該需要一個。 還有更多問題。
仔細查看渲染過程中發生的堆棧跟蹤:
com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
UILeaf
> UIInstructions
是 EL 在模板文本中的 Facelets 表示,如下所示
<p>Welcome, #{user.name}</p>
這是出乎意料的,因為您在<p:autoComplete>
組件中聲明了 EL 表達式,該組件應該在該行中顯示為org.primefaces.component.autocomplete.AutoComplete
。 因此,這意味着<p:xxx>
標記庫無法識別並被解釋為模板文本,因此在生成 HTML 輸出期間保持未解析狀態。 <p:autoComplete>
,您將<p:autoComplete>
普通的 vanilla 發送到 webbrowser,而不是讓 JSF 生成其 HTML 輸出。
這反過來可能有多種原因,最常見的是:
/WEB-INF/lib
)。xmlns:p="http://primefaces.org/ui"
)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.