unable to get "ItemValue" of selected item using f:selectitems tag in ace:autocompleteEntry

Posted by user1641976 on Stack Overflow See other posts from Stack Overflow or by user1641976
Published on 2012-09-14T08:37:51Z Indexed on 2012/09/17 3:37 UTC
Read the original article Hit count: 944

Filed under:
|
|

i want to get the Value of selectItem (ItemValue which is an Integer and the Item Label is String) in my backing bean using autocompleteentry tag of icefaces 3.1.0

but i get error:

here is the code:

  <tr>
       <td>Current City</td>
        <td>
        <ace:autoCompleteEntry value="#{service.cityId}" styleClass="select-field"  rows="10" width="400"
                               filterMatchMode=""  >

            <f:selectItems value="#{service.cities}" ></f:selectItems>

       </ace:autoCompleteEntry>

     </td>
      </tr>

Bean is :

  public class Service{
    private Integer cityId;
    public Integer getCityId() {
    return cityId;
   }
    public void setCityId(Integer cityId) {
    this.cityId= cityId;
}

     private <SelectItem> cities;

    public List<SelectItem> getCities() {
    return cities=Dao.getCityList();
}
public void setCities(List<SelectItem> cities) {
    this.cities= cities;
} 
     }

the cities has itemvalue as a number and itemLabel as String stored in it. I do get autocomplete fine and shows list of matches if i store value in some String property of backing bean but if storing in integer property of bean, gives this error as soon i write something in autocomplete.

 INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
 sourceId=frmmaster:j_idt205:txtcity[severity=(ERROR 2), summary=(frmmaster:j_idt205:txtcity: 'a' must be a number consisting of one or more digits.), detail=(frmmaster:j_idt205:txtcity: 'a' must be a number between -2147483648 and 2147483647 Example: 9346)]

Kindly reply any person i need to solve this issue as soon as possible.

© Stack Overflow or respective owner

Related posts about jsf-2.0

Related posts about autocomplete