4 Replies Latest reply on Nov 11, 2010 4:13 AM by romyo0o

    suggestionAction method used in suggestionbox is called twice per request

    romyo0o

      Hello,

       

      I'm using <rich:suggestionbox />

       

      I wrote a method to handle suggestions list for suggestionAction attribute, and this method is called twice per one request!

       

       

       

      Is this issue related to JSF life cycle, and what's the solution ?

       

      - Below is the JSF tag and the method:

       

       

      <h:inputText id="idTxt" 
      
      value="#{managedBean.id}" />  
      
      
      <rich:suggestionbox id="suggestionBoxId" 
      
      for="idTxt" tokens=",[]" 
      suggestionAction="#{managedBean.autocomplete}" 
      var="result" fetchValue="#{result.id}" 
      minChars="2" nothingLabel="No data" 
      columnClasses="center" usingSuggestObjects="true"> 
      
      
      
      
      

       

       

      and This is the autoComplete method:

       

       

      public List<Bean> autocomplete(Object guiInput) 
      {
       String input = (String) guiInput;
      ArrayList<Bean> result =
      new ArrayList<Bean>(); 
      
      for (Bean bean: bigBean.getBeanList()) {
      
      if ((bean.getId() != 0 && Integer.toString( bean.getId()).indexOf(input) == 0))
      {
      result.add(bean);
      }
      
      }
      
      return result; }
      
      
      
      
      
       
      
      

       

       

      Thanks,