title: Trouble on making example on primefaces autocomplete component
body: <p>I am learning how to use primefaces framework. I set up a project for making examples and I'm having some trouble with making an autocomplete component work. I wanted to show hints for "players" on this autocomplete component by it's name based on a source of players but no hints are shown. I don't have much experience on ajax neither on beans, obviously I'm doing something wrong. Thanks for helping!</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://xmlns.jcp.org/jsf/html"
        xmlns:p="http://primefaces.org/ui"&gt;&gt;
      &lt;h:head&gt;
          &lt;title&gt;Autocomplete&lt;/title&gt;
      &lt;/h:head&gt;
      &lt;h:body&gt;
          &lt;h:form&gt;
              &lt;p:autoComplete value="#{autoComplBean.selectedPlayer}" 
                 completeMethod="#{autoComplete.complete}" var="p" 
                 itemLabel="#{p.name}" itemValue="#{p}" dropdown="true"&gt;
              &lt;/p:autoComplete&gt;
          &lt;/h:form&gt;
      &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>import java.util.ArrayList;
  import java.util.Iterator;
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.RequestScoped;
  
  @ManagedBean
  @RequestScoped
  public class autoComplBean {
  
      private acPlayer selectedPlayer;
      private ArrayList&lt;acPlayer&gt; autoCompleteList;
  
      public autoComplBean() {
          selectedPlayer = new acPlayer();
          autoCompleteList = new ArrayList();
          autoCompleteList.add(new acPlayer("rodri", "martinez", 22));
          autoCompleteList.add(new acPlayer("junior", "martinez", 27));
          autoCompleteList.add(new acPlayer("rodri", "heredia", 25));
          autoCompleteList.add(new acPlayer("juan", "gonzales", 22));
          autoCompleteList.add(new acPlayer("prueba", "jugador", 23));
          autoCompleteList.add(new acPlayer("otro", "player", 27));
          autoCompleteList.add(new acPlayer("auto", "complete", 101));
          autoCompleteList.add(new acPlayer("ajax", "primefaces", 29));
      }
  
      public ArrayList&lt;acPlayer&gt; complete(String query){
          ArrayList&lt;acPlayer&gt; players = readPlayers(query);
          return players;
      }
  
      public ArrayList&lt;acPlayer&gt; readPlayers(String name){
  
          if(name.equals("")){
              return autoCompleteList;
          }
          else{
              ArrayList&lt;acPlayer&gt; result = new ArrayList();
              for (acPlayer current : autoCompleteList) {
                  if(current.getName().startsWith(name)){
                      result.add(current);
                  }
              }
              return result;
          }
  
      }
  
      public void setSelectedPlayer(acPlayer selectedPlayer) {
          this.selectedPlayer = selectedPlayer;
      }
  
      public void setAutoCompleteList(ArrayList&lt;acPlayer&gt; autoCompleteList) {
          this.autoCompleteList = autoCompleteList;
      }
  
      public acPlayer getSelectedPlayer() {
          return selectedPlayer;
      }
  
      public ArrayList&lt;acPlayer&gt; getAutoCompleteList() {
          return autoCompleteList;
      }
  
  }
  
  public class acPlayer {
      private String name;
      private String surname;
      private int age;
  
      public acPlayer() {
          name = "";
          surname = "";
          age = 0;
      }
  
      public acPlayer(String name, String surname, int age) {
          this.name = name;
          this.surname = surname;
          this.age = age;
      }
  
      // setters getters
  </code></pre>