Using <ui:repeat><h:inputText> on a List<String> doesn&#39;t update model values

和自甴很熟 提交于 2019-11-25 22:49:51

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).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!