相关疑难解决方法(0)

在List <String>上使用<ui:repeat> <h:inputText>不会更新模型值

这是场景(简化):

有一个bean(称之为mrBean)与成员和适当的getter/setter:

private List<String> rootContext;

public void addContextItem() {
    rootContext.add("");
}
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

问题是,当单击"添加"按钮时,不会执行<h:inputText/>在表示字符串中的值中输入的值stringList.

实际上,从不调用mrBean.stringListsetter(setStringList(List<String> stringList)).

知道为什么吗?

一些信息 - 我在Tomcat 6上使用MyFaces JSF 2.0.

string jsf list jsf-2 uirepeat

9
推荐指数
1
解决办法
8746
查看次数

标签 统计

jsf ×1

jsf-2 ×1

list ×1

string ×1

uirepeat ×1