在List <String>上使用<ui:repeat> <h:inputText>不会更新模型值
这是场景(简化):
有一个bean(称之为mrBean)与成员和适当的getter / setter:
private List<String> rootContext;public void addContextItem() {
rootContext.add("");}JSF代码:
<h:form id="a_form">
<ui:repeat value="#{mrBean.stringList}" var="stringItem">
<h:inputText value="#{stringItem}" />
</ui:repeat>
<h:commandButton value="Add" action="#{mrBean.addContextItem}">
<f:ajax render="@form" execute="@form"></f:ajax>
</h:commandButton></h:form>问题是,当单击“添加”按钮时,不会执行<h:inputText/>在表示字符串中的值中输入的值stringList。
实际上,从不调用mrBean.stringListsetter(setStringList(List<String> stringList))。
知道为什么吗?
一些信息 - 我在Tomcat 6上使用MyFaces JSF 2.0。
宝慕林4294392
繁星coding
随时随地看视频慕课网APP