What data type to use to contain List Select values?

I have a multi-select component that users can select more than 1 item. I have a BeanFieldGroup in the backend to capture the result.

Right now in my bean, I use data type String to contain the values of the List Select component but it failed to bind. What should I use please?

Thanks

Hi,

What is the type of the field in the object you bind with BeanFieldGroup? The multiselects in core Vaadin are not that handy unless you happen to be using Collection or Set as your type. They’ll always try to assign a new HashSet of your selected values to your bound field.

You might be better of by using MultiSelectTable from Viritin add-on. It just modifies values in existing collections. If you are just using String’s you should though configure the Table so that it shows only the itemId (your options of type String) and probably you also want to hide column headers to make the component look like a ListSelect.

cheers,
matti

I had String in my java bean but now I changed it to Collection and it’s working now.

Thanks