Using on a List doesn’t update model values

The String class is immutable and doesn’t have a setter for the value. The getter is basically the Object#toString() method.

You need to get/set the value directly on the List instead. You can do that by the list index which is available by <ui:repeat varStatus>.

<ui:repeat value="#{mrBean.stringList}" varStatus="loop">
    <h:inputText value="#{mrBean.stringList[loop.index]}" />
</ui:repeat>

You don’t need a setter for the stringList either. EL will get the item by List#get(index) and set the item by List#add(index,item).

Leave a Comment