This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes h:selectManyListbox NO VALUES returned if binding used Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "h:selectManyListbox NO VALUES returned if binding used" Watch "h:selectManyListbox NO VALUES returned if binding used" New topic
Author

h:selectManyListbox NO VALUES returned if binding used

Sergey Kargopolov
Ranch Hand

Joined: Jul 04, 2003
Posts: 63
<h:selectManyListbox value="#{EventJSFBean.selectedUserFriends}" binding="#EventJSFBean.selectedMenuComponent}">

<f:selectItems value="#{EventJSFBean.userFriends}"/>

</h:selectManyListbox>

When I click on Submit button method getSelectedUserFriends() returns me correct values. That tells me that selected values are being submited. But selectedMenuComponent(which is my binding) is always empty. I cannot access values thru compoment UISelectMany. Please help me to find where I am wrong.


public UISelectMany getSelectedMenuComponent()
{
System.out.println("Here in getSelectMenuComponent()");
Object[] selectedUsers = selectedMenuComponent.getSelectedValues(); // THIS IS ALWAYS EMPTY, EVEN WHEN FORM IS SUBMITED. WHY?
return this.selectedMenuComponent;
}


selectedMenuComponent.getSelectedValues();
is always empty. But why?


if I try to do this


public UISelectMany getSelectedMenuComponent()
{
List v = selectedMenuComponent.getChildren();
Iterator i = v.iterator();
while(i.hasNext())
{
javax.faces.component.UISelectItems si = (javax.faces.component.UISelectItems )i.next();
List list = si.getChildren();
if(list==null) return "";
System.out.println(list.size());

Iterator iter = list.iterator();
while(iter.hasNext())
{
System.out.println(iter.next().getClass());
}
}

return this.selectedMenuComponent;

}

Children of UISelectMany are also empty.. meaning zero is returned.


Please advise me what am I doing wrong?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: h:selectManyListbox NO VALUES returned if binding used
 
Similar Threads
moving values
selectManyListbox tag bug in JSF Jsp
UISelectMany and EvaluationException
populate list box from resource bundle
selectManyCheckbox