Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

h:selectManyListbox issue

N Ha
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I need to get a multiple select drop down component.
How can this be acheieved?

I tried
<h:selectManyListbox id="groups" value="#{customerController.selected.groups}">
<f:selectItems value="#{groupController.itemsAvailableSelectMany}"/>

I get the Objects displayed, but I need the name to be displayed instead.

And when I try to submit, I get an error j_idt50:groups: Validation Error: Value is not valid

though the values are displayed correct in the view source

<select id="j_idt50:groups" name="j_idt50:groups" multiple="multiple" size="2">
<option value="1" selected="selected">com.entity.Group@ffc9ca</option>
<option value="2">com.entity.Group@118f163</option>

Here is my code

@ManagedBean (name="groupController")
public class GroupController {
public SelectItem[] getItemsAvailableSelectMany() {
return JsfUtil.getSelectItems(ejbFacade.findAll(), false);

public class GroupConverter implements Converter {
public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
if (object instanceof Group) {
Group o = (Group) object;
return new String(new Integer(o.getGroupId()).toString());
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic