Reputation: 1211
Part of my xhmtl-Page:
<rich:autocomplete autocompleteMethod="#{autocompletMit.searchbyName()}" mode="cachedAjax"
fetchValue="#{controller.mitarbeiter.mitarbeiterName}" autocompleteList="#{autocompletMit.autocompleteList}" minChars="1" autofill="true" var="it" >
<h:outputText value="#{it.mitarbeiterName}" style="font-weight:bold"/>
</rich:autocomplete>
Bean for my Autocomplete:
@ManagedBean(name = "autocompletMit")
@RequestScoped
public class AutoCompleteMitarbeiter implements Serializable {
@EJB
private Transaktionssteuerung transakt;
private List<String> autocompleteList = new ArrayList<String>();
String nameSearch;
public List<String> searchbyName(Object o) {
String test = (String) o;
List<Mitarbeiter> alleMitarbeiter = transakt.alleMitarbeiter();
for (Iterator<Mitarbeiter> it = alleMitarbeiter.iterator(); it.hasNext();) {
if (it.next().getMitarbeiterName().startsWith(test)) {
autocompleteList.add(it.next().getMitarbeiterName());
}
}
return autocompleteList;
}
//getter & setter
}
I always get "Unkown property searchbyName" in my .xhtml for autocompleteMethod="#{autocompletMit.searchbyName()}"
because he excepts a value... Which value do i have to submit here?!?
Upvotes: 1
Views: 6611
Reputation: 1108852
autocompleteMethod="#{autocompletMit.searchbyName()}"
This is not correct when you've a method which takes arguments. Remove those parentheses. The RichFaces <rich:autocomplete>
showcase example also doesn't show at all that you should be invoking an argumentless method.
Method not found: [email protected] (java.lang.String)
It's telling that it expected a searchbyName
method taking a String
argument. Yours takes an Object
argument. This does not match. Fix it accordingly:
public List<String> searchbyName(String query) {
Upvotes: 5