tags:

views:

576

answers:

1

Hi, Is there a way to dynamically create a selectItem list? I dont really want to have to create lots of bean code to make my lists return List<SelectItem>...

I tried this:

<ice:selectManyCheckbox>
    <ui:repeat var="product" value="#{productListingService.list}">
      <f:selectItem itemLabel="#{product.description}" value="#{product.id}"/>
    </ui:repeat>
</ice:selectManyCheckbox>

but it doesnt work.

Any ideas?

+3  A: 

Use f:selectItems instead. It accepts a List<SelectItem>, SelectItem[] or Map<String, Object> as value. Or if you're already on JSF 2.0, then you can use f:selectItems for a collection of beans as well:

<f:selectItems value="#{productListingService.list}" var="product" 
    itemLabel="#{product.description}" itemValue="#{product.id}" />
BalusC