wood burning stoves*
The moose likes JSF and the fly likes ace:autoCompleteEntry unable to put selected item value in backing bean property Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "ace:autoCompleteEntry unable to put selected item value in backing bean property" Watch "ace:autoCompleteEntry unable to put selected item value in backing bean property" New topic
Author

ace:autoCompleteEntry unable to put selected item value in backing bean property

Zainab Haf
Greenhorn

Joined: Sep 17, 2012
Posts: 11
Hi i am new here , kindly help in the follow issue i am facing for days.

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:



Bean is :



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)]


Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15962
    
  19

I think you are trying to permit people to type in a city name but have it resolve to a numeric city ID. The user typed in "a", and since that's not a number, the validator got annoyed.

SelectItems are value/label pairs, and presumably you want the user to type the label and have JSF set the value. Which can be a problem when you have an incomplete label that doesn't correspond to any value in the selectitem collection.

That's about as much help as I can give, since I'm not familiar with the "ace" tag library, but hopefully it will help.


Customer surveys are for companies who didn't pay proper attention to begin with.
Zainab Haf
Greenhorn

Joined: Sep 17, 2012
Posts: 11
Thanks that really made me understand the problem why it would not set the the value in cityID if using SlecetItem list because of incomplete entered value(Label) is not having any item value(Integer) in the list.

but i have done the same thing another way by giving a list of City class objects to this autocomplete tag instead of list of selectItems (following this tutorial icefaces Showcase)but that also didnt work as page page gets blurred out whenever i enter some character or says "internel server error" despite i m getting the correct list in getter of list<Citiy> i am using in tag. Atleast it should show the list in autocomplete even if i dont store anything in backing bean.



in bean Class added this property:



Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15962
    
  19

Unfortunately, that requires more knowledge of IceFaces than I currently have at my fingertips.

One thing, though. Your display name doesn't conform to our naming requirements (http://www.javaranch.com/name.jsp). I recommend you repair it before one of the enforcement-type people take notice.
Zainab Haf
Greenhorn

Joined: Sep 17, 2012
Posts: 11
Ok thankyou and i will change name.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ace:autoCompleteEntry unable to put selected item value in backing bean property
 
Similar Threads
Birth Date nightmare - passing variable between beans and java objects
<h:selectOneMenu> problem
selectOneRadio, backing beans and mapping (ICEfaces)
noSuchElementException when using SelectoneMenu
Validation Error: Value is not valid