This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

h:selectManyListbox issue  RSS feed

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());
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!