• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

h:selectManyListbox issue

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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}"/>
</h:selectManyListbox>

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>
</select>

Here is my code

@ManagedBean (name="groupController")
@SessionScoped
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());
}
}
}
 
reply
    Bookmark Topic Watch Topic
  • New Topic