Hi,
I am trying to create a selctOneMenum, and I have the following snapshot of
xhmtl file:
<t:selectOneMenu value="#{libraryUser.group}">
<f:selectItems value="#{choice.groups}"/>
</t:selectOneMenu>
Choice.java (choice.groups) is as follows:
public class Choice {
private List<SelectItem> groups=new ArrayList<SelectItem>();
public Choice() {
groups.add(new SelectItem(1,"Test"));
groups.add(new SelectItem(2,"Test1"));
}
public List<SelectItem> getGroups() {
return groups;
}
public void setGroups(List<SelectItem> groups) {
this.groups = groups;
}
}
I, however, is getting error message:
Caused by: java.lang.IllegalArgumentException: Value binding
'#{choice.groups}'of UISelectItems with component-path {Component-Path :
[Class: javax.faces.component.UIViewRoot,ViewId:
/pages/userInput.xhtml][Class: javax.faces.component.html.HtmlForm,Id:
helloForm][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id8][Class:
org.apache.myfaces.component.html.ext.HtmlSelectOneMenu,Id: j_id19][Class:
javax.faces.component.UISelectItems,Id: j_id20]} does not reference an
Object of type SelectItem, SelectItem[], Collection or Map but of type :
null
at
org.apache.myfaces.shared_tomahawk.util.SelectItemsIterator.hasNext(SelectItemsIterator.java:166)
>From the error message, it sounds like groups does not have SelectItem
object, and I am missing something. I appreciate if somebody can provide me
some pointers.
Thanks,
With regards,
Damar