2 Replies Latest reply on Sep 26, 2008 2:43 AM by Francisco Jose Peredo Noguez

    rich:suggestionbox box issue

    Nagendra krishnawat Newbie

      I am using a very basic suggestion box, Here is the code:

      <h:inputText id="employeeToAdd"/>
      <rich:suggestionbox for="employeeToAdd" suggestionAction="#{accountHome.autocomplete}" var="suggest">
                   <h:outputText value="#{suggest.version}"/>

      Bean code:

       public List<AbstractContact> autocomplete(Object event) {
              List<AbstractContact> resultList = (List<AbstractContact>)getEntityManager().createNativeQuery("SELECT * FROM ABSTRACT_CONTACT ABC WHERE ABC.ID not in ( SELECT ACC.ID FROM ACCOUNT_CONTACT ACC) and ABC.FULL_NAME LIKE :FULLNAME").setParameter("FULLNAME",'%'+event.toString()+'%').getResultList();
              return resultList;        

      This code always gives me a number format exception when I type a letter in text box.

      SEVERE: Error Rendering View[/portfolio/AccountEdit.xhtml]
      java.lang.NumberFormatException: For input string: "version"
              at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
              at java.lang.Integer.parseInt(Integer.java:447)
              at java.lang.Integer.parseInt(Integer.java:497)
              at javax.el.ArrayELResolver.coerce(ArrayELResolver.java:153)
              at javax.el.ArrayELResolver.getValue(ArrayELResolver.java:45)

      Kindly suggest, what is causing the problem. I checked the resultList and it is returning object of type AbstractContact.