I’m trying to embed the primefaces autocomplete method inside a composite component.
However, it fails when trying to access the “complete” method.
Here is my code:
..
<composite:interface>
<composite:attribute name="car" required="true" />
<composite:attribute name="brandList" required="true" method-signature="java.util.List complete(java.lang.String)" />
<composite:attribute name="style" required="false" />
</composite:interface>
<composite:implementation>
..
<h:outputLabel value="DropDown :" for="dd" />
<p:autoComplete id="dd" dropdown="true" value="#{cc.attrs.car.brand}" completeMethod="#{cc.attrs.brandList}" />
..
</composite:implementation>
And the call:
<cp:carPropertiesAutoComplete car="#{carController.car}" brandList="#carController.complete}" />
And the backing bean:
public List<String> complete(String query) {
List<String> brandList = new ArrayList<String>();
brandList.add("brand0");
brandList.add("brand1");
for (String brand : brandList) {
if(brand.contains(query)) {
brandList.add(brand);
}
}
return brandList;
}
And the log:
WARNING: /newCarAutoComplete.xhtml @17,112
brandList=”#{carController.complete}”: The class ‘CarController’ does
not have the property ‘complete’. javax.el.PropertyNotFoundException:
/newCarAutoComplete.xhtml @17,112
brandList=”#{carController.complete}”: The class ‘CarController’ does
not have the property ‘complete’. 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:340)
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.StandardWrapper.service(StandardWrapper.java:1542)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at
com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)
I have googled around and found this (same problem with no solution)
http://forum.primefaces.org/viewtopic.php?f=3&t=1884
I am running Glassfish server 3.1.2 with Mojarra 2.1.6 and PrimeFaces 3.3.1
Can you please help me? I have struggled with this for hours =(
Why you dont create your complete method in a @FacesComponent? and then use {cc.brandList} not {cc.attrs.brandList}