You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matthias Kahlau <mk...@web.de> on 2006/01/19 00:48:02 UTC
Problem with selectOneMany Value-Binding
Hi!
To create a List for the selectItems value, I do the following:
1) I create a List of Object Arrays of size 2 containing a constant
Character as value and a constant String as label. The List is a static
final LinkedList.
2) To build a List of SelectItem instances, I iterate over the List
containing the Object Arrays in the following method:
public static LinkedList createSelectItemsListCharKey(List objArrList) {
LinkedList linkedList = new LinkedList();
Iterator it = objArrList.iterator();
while (it.hasNext()) {
Object arr[] = (Object[])it.next();
Character value = (Character)arr[0];
String label = (String)arr[1];
linkedList.add(new SelectItem(value, label));
}
return linkedList;
}
---
I think the problem is caused by the fact that step 2 is performed more than
once with the same List from step 1, because I need the options in more than
one selectOneMany.
When I do this, I get the following error, and "umfrTypOptions" is one of
many Lists of SelectItem instances. There are others build in other
Backing-Beans.
Value binding '#{UmfrSuperManUmfrTabBacking.umfrTypOptions}'of
UISelectItems with component-path {Component-Path : [Class:
javax.faces.component.UIViewRoot,ViewId:
/Management/ManagementTabbedPane.jsp][Class:
javax.faces.component.html.HtmlForm,Id: managementForm][Class:
org.apache.myfaces.custom.tabbedpane.HtmlPanelTabbedPane,Id: _id1][Class:
org.apache.myfaces.custom.tabbedpane.HtmlPanelTab,Id: tab3][Class:
javax.faces.component.html.HtmlPanelGrid,Id: _id158][Class:
org.apache.myfaces.custom.column.HtmlSimpleColumn,Id: _id161][Class:
javax.faces.component.html.HtmlSelectOneMenu,Id: umfragetyp2][Class:
javax.faces.component.UISelectItems,Id: _id162]} does not reference an
Object of type SelectItem, SelectItem[], Collection or Map but of type :
null
java.lang.IllegalArgumentException: Value binding
'#{UmfrSuperManUmfrTabBacking.umfrTypOptions}'of UISelectItems with
component-path {Component-Path : [Class:
javax.faces.component.UIViewRoot,ViewId:
/Management/ManagementTabbedPane.jsp][Class:
javax.faces.component.html.HtmlForm,Id: managementForm][Class:
org.apache.myfaces.custom.tabbedpane.HtmlPanelTabbedPane,Id: _id1][Class:
org.apache.myfaces.custom.tabbedpane.HtmlPanelTab,Id: tab3][Class:
javax.faces.component.html.HtmlPanelGrid,Id: _id158][Class:
org.apache.myfaces.custom.column.HtmlSimpleColumn,Id: _id161][Class:
javax.faces.component.html.HtmlSelectOneMenu,Id: umfragetyp2][Class:
javax.faces.component.UISelectItems,Id: _id162]} does not reference an
Object of type SelectItem, SelectItem[], Collection or Map but of type :
null
at
org.apache.myfaces.util.SelectItemsIterator.hasNext(SelectItemsIterator.java
:142)
Do you know why this doesn't work? The collection or map pointed to in the
error message cannot really be null, I think that's only a symptom produced
by JSF... When I use a step 2 List only one time, no error happens.
Regards,
Matthias
Re: Problem with selectOneMany Value-Binding
Posted by Dave Brondsema <da...@brondsema.net>.
What is your getUmfrTypOptions() method? You only showed
createSelectItemsListCharKey.
Your method should not be static. Also, it should return an array
(SelectItem[]) not a list.
Matthias Kahlau wrote:
> Hi!
>
>
> To create a List for the selectItems value, I do the following:
>
> 1) I create a List of Object Arrays of size 2 containing a constant
> Character as value and a constant String as label. The List is a static
> final LinkedList.
>
> 2) To build a List of SelectItem instances, I iterate over the List
> containing the Object Arrays in the following method:
>
> public static LinkedList createSelectItemsListCharKey(List objArrList) {
> LinkedList linkedList = new LinkedList();
> Iterator it = objArrList.iterator();
> while (it.hasNext()) {
> Object arr[] = (Object[])it.next();
> Character value = (Character)arr[0];
> String label = (String)arr[1];
> linkedList.add(new SelectItem(value, label));
> }
> return linkedList;
> }
>
> ---
>
> I think the problem is caused by the fact that step 2 is performed more than
> once with the same List from step 1, because I need the options in more than
> one selectOneMany.
>
> When I do this, I get the following error, and "umfrTypOptions" is one of
> many Lists of SelectItem instances. There are others build in other
> Backing-Beans.
>
> Value binding '#{UmfrSuperManUmfrTabBacking.umfrTypOptions}'of
> UISelectItems with component-path {Component-Path : [Class:
> javax.faces.component.UIViewRoot,ViewId:
> /Management/ManagementTabbedPane.jsp][Class:
> javax.faces.component.html.HtmlForm,Id: managementForm][Class:
> org.apache.myfaces.custom.tabbedpane.HtmlPanelTabbedPane,Id: _id1][Class:
> org.apache.myfaces.custom.tabbedpane.HtmlPanelTab,Id: tab3][Class:
> javax.faces.component.html.HtmlPanelGrid,Id: _id158][Class:
> org.apache.myfaces.custom.column.HtmlSimpleColumn,Id: _id161][Class:
> javax.faces.component.html.HtmlSelectOneMenu,Id: umfragetyp2][Class:
> javax.faces.component.UISelectItems,Id: _id162]} does not reference an
> Object of type SelectItem, SelectItem[], Collection or Map but of type :
> null
> java.lang.IllegalArgumentException: Value binding
> '#{UmfrSuperManUmfrTabBacking.umfrTypOptions}'of UISelectItems with
> component-path {Component-Path : [Class:
> javax.faces.component.UIViewRoot,ViewId:
> /Management/ManagementTabbedPane.jsp][Class:
> javax.faces.component.html.HtmlForm,Id: managementForm][Class:
> org.apache.myfaces.custom.tabbedpane.HtmlPanelTabbedPane,Id: _id1][Class:
> org.apache.myfaces.custom.tabbedpane.HtmlPanelTab,Id: tab3][Class:
> javax.faces.component.html.HtmlPanelGrid,Id: _id158][Class:
> org.apache.myfaces.custom.column.HtmlSimpleColumn,Id: _id161][Class:
> javax.faces.component.html.HtmlSelectOneMenu,Id: umfragetyp2][Class:
> javax.faces.component.UISelectItems,Id: _id162]} does not reference an
> Object of type SelectItem, SelectItem[], Collection or Map but of type :
> null
> at
> org.apache.myfaces.util.SelectItemsIterator.hasNext(SelectItemsIterator.java
> :142)
>
>
> Do you know why this doesn't work? The collection or map pointed to in the
> error message cannot really be null, I think that's only a symptom produced
> by JSF... When I use a step 2 List only one time, no error happens.
>
>
> Regards,
>
> Matthias
>
--
Dave Brondsema
Software Developer
Cornerstone University