-
1. Re: Value not a valid option
maksimkaszynski Sep 18, 2007 7:53 AM (in response to guisho)Looks like some conversion problem. Could you please attach ClientBackingBean source code?
-
2. Re: Value not a valid option
guisho Sep 18, 2007 1:29 PM (in response to guisho)Below is the code.
I also created a custom validator to check the value, and the value is null. It is strange because when I see the rendered page I get to see the listbox correctly. Thanks in advance.
public SelectItem[] getTypesItems() {
List list = ClientManager.getList();
Iterator i = list.iterator();
List toItem = new ArrayList();
List toItemDesc = new ArrayList();
Client next = null;
while (i.hasNext()) {
next = (Client) i.next();
toItem.add(next.getId().toString());
toItemDesc.add(next.getId().toString());
}
return JSFUtils.list2SelectItem(toItem, toItemDesc);
}
======
JSFUtils.list2SelectItem goes like this:
public static SelectItem [] list2SelectItem(List list, List label) {
SelectItem [] toReturn=new SelectItem[list.size()];
int count=0;
try {
Iterator i=list.iterator();
Iterator i2=label.iterator();
String str1="";
String str2="";
while(i.hasNext()||i2.hasNext()) {
str1=i.next().toString();
str2=i2.next().toString();
System.out.println("str1:<"+str1+"> str2:<"+str2+">");
toReturn[count]=new SelectItem(str1,str2);
count++;
}
} catch(Exception e) {
toReturn=null;
e.printStackTrace();
}
return toReturn;
}
===== -
3. Re: Value not a valid option
maksimkaszynski Sep 18, 2007 1:43 PM (in response to guisho)Still unclear.
What is the type of #{ClientBackingBean.type} property -
4. Re: Value not a valid option
guisho Sep 18, 2007 2:56 PM (in response to guisho)It is a Long. :)
-
5. Re: Value not a valid option
ilya_shaikovsky Sep 19, 2007 5:08 AM (in response to guisho)You should convert it. Value evaluated to String.
-
6. Re: Value not a valid option
guisho Sep 22, 2007 2:09 AM (in response to guisho)Hi, thank you for your answers. You were right, my error was a convertion problem. It was not richfaces who caused it, it was myfaces. My code used to work because myfaces wasn't sticking to the JSF specification, but aftwr version 1.1.5 they fixed the error, and throwed it to me.
If is it useful for someone read the link in myfaces wiki:
http://wiki.apache.org/myfaces/FAQ at the end of the page.
Greetings to all, and thank you,
Luis