aspose file tools
The moose likes JSF and the fly likes h:selectManyListbox issue Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "h:selectManyListbox issue" Watch "h:selectManyListbox issue" New topic
Author

h:selectManyListbox issue

N Ha
Greenhorn

Joined: Jun 02, 2010
Posts: 9
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());
}
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: h:selectManyListbox issue
 
Similar Threads
SelectManyListbox converter problem
getAsObject never called
Validation Error: Value is not valid
suppress ConverterException messages from displaying in browser
getAsObject converter