Hey all,

I'm trying to use a selectManyListbox component on a page to allow the user to select multiple things. The SelectItems are created from a list returned from Hibernate so the value object is of type Long. In my backing bean I'm using the following methods:

public Long[] getSelectedItems();
public void setSelectedItems (Long[] ids);

The page comes up just fine to start with but when I try to submit it I get conversion error. The headlines from the stack trace are:

javax.faces.el.EvaluationException: Cannot set value for expression '#{departmentTypeHandler.selectedInstitutionTypeIds}' to a new value of type [Ljava.lang.Object;

Caused by: javax.servlet.jsp.el.ELException: Attempt to coerce a value of type "[Ljava.lang.Object;" to type "[Ljava.lang.Long;

I tried setting a converter on the selectManyListbox with converter="javax.faces.Long" to try and make it convert the String[] to a Long[]. But that didn't work at all, seemed as if the converter didn't even get used. Is this the right approach or do I need to create a converter for converting a String[] to a Long[]? I know I could probably convert the value to of the SelectItems to Strings, but I'd rather not do that unless I absolutely have to. Seems a little hackish. What else might I try?

Thanks,
Rich

Reply via email to