0

我正在使用复合组件来构建自动完成组件..当我尝试为 completeMethod.am 引用方法时遇到此异常。

这是代码

在我的 parent.xhtml

<composite:attribute name="completefornameforreportee"
                     method-signature="java.util.List m(java.lang.String)"/>
<p:autoComplete id="empIdText2" value="#{cc.attrs.empNameforreportee}"
                completeMethod="#{cc.attrs.completefornameforreportee}">
    <p:ajax event="itemSelect"
            listener="#{cc.attrs.bean[cc.attrs.handlerforempNamereportee]}"
            update=":form" />
</p:autoComplete>

在完整的.xhtml

bean="#{autoCompleteBean}"
completefornameforreportee="#{autoCompleteBean.completeforNameforreportee}"

AutocompleteBean.java

public List<String> completeforNameforreportee(String query) throws Exception {
    System.out.println("called");
    List<String> finalNameResults = new ArrayList<String>();
    return finalNameResults;
}

堆栈跟踪:

javax.el.PropertyNotFoundException: /ChangeReportHierarchy.xhtml @97,55 completefornameforreportee="#{autoCompleteBean.completeforNameforreportee}": Property 'completeforNameforreportee' not found on type com.hrmsrevamp.service.ChangeReportHierarchy
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111)
    at com.sun.faces.facelets.el.ContextualCompositeMethodExpression.invoke(ContextualCompositeMethodExpression.java:190)
    at com.sun.faces.facelets.tag.TagAttributeImpl$AttributeLookupMethodExpression.invoke(TagAttributeImpl.java:450)
    at org.primefaces.component.autocomplete.AutoComplete.broadcast(AutoComplete.java:358)
    at javax.faces.component.UIData.broadcast(UIData.java:1093)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:935)
    at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
4

1 回答 1

0

#{autoCompleteBean.completeforNameforreportee}期望一个completeforNameforreportee具有扩展类型和 getter 和 setter 的属性。像这样的东西:

public <YourType> completeforNameforreportee;

public <YourType> getCompleteforNameforreportee() {
    return completeforNameforreportee;
}

public void setCompleteforNameforreportee(<YourType> completeforNameforreportee) {
    this.completeforNameforreportee = completeforNameforreportee;
}
于 2013-03-13T07:58:47.573 回答