title: rich:autocomplete prefix
body: <p>I'm testing the autocomplete component, but I don't understand how prefix (used as search input) is passed to the bean.
  Here my code:</p>
  
  <p>page:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:t="http://myfaces.apache.org/tomahawk"&gt;
  
  &lt;f:loadBundle basename="resources.application" var="msg" /&gt;
  
  &lt;h:head&gt;
      &lt;title&gt;Test page
      &lt;/title&gt;
  &lt;/h:head&gt;
  
  &lt;h:body&gt;
      &lt;rich:panel style="height:500px;overflow:auto"&gt;
  
           &lt;rich:autocomplete mode="cachedAjax" tokens=", " minChars="1"
              autofill="false"
              autocompleteMethod="#{comuniBean.autocomplete}" /&gt;
  
  
      &lt;/rich:panel&gt;
  
  
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Bean:</p>
  
  <pre><code>package it.ubi.test.bean;
  
  import java.io.Serializable;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  
  public class ComuniBean implements Serializable{
  
      private static final long serialVersionUID = 1L;
  
      private ArrayList&lt;String&gt; comuniList;
  
      public void init() {
          comuniList = new ArrayList&lt;String&gt;();
          comuniList.add("Brescia (BS)");
          comuniList.add("Milano (MI)");
          comuniList.add("Bergamo (BG)");
      }
  
      public List&lt;String&gt; autocomplete(String prefix) {
          ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;();
          if ((prefix == null) || (prefix.length() == 0)) {
                  comuniList = new ArrayList&lt;String&gt;();
                  comuniList.add("Brescia (BS)");
                  comuniList.add("Milano (MI)");
                  comuniList.add("Bergamo (BG)");
                  result = comuniList;
          } else {
              Iterator&lt;String&gt; iterator = comuniList.iterator();
              while (iterator.hasNext()) {
                  String elem = iterator.next();
                  if ((elem.toLowerCase().indexOf(prefix.toLowerCase()) == 0)
                      || "".equals(prefix)) {
                      result.add(elem);
                  }
              }
          }
          return result;
      }
  
  
      }
  </code></pre>
  
  <p>The "prefix" variable is always null. Can somebody explain how to get the prefix value?</p>