【问题标题】:How to update <ui:repeat> data without page reload?如何在不重新加载页面的情况下更新 <ui:repeat> 数据?
【发布时间】:2014-05-13 07:30:41
【问题描述】:

我有一个用户名列表,并且用户名列表会根据用户给出的输入数量增加。事情是当用户输入用户名时,列表中会填充输入,而我的只会更新当我的页面重新加载时。这是我到目前为止尝试过的代码。

 <ui:repeat id="update" value="#{data.value}" var="tes">

 #{tes.name}
 </ui:repeat>

 <h:inputText value=#{data.name}/>
 <p:commandButton actionListener="#{data.addname()}" update="update"/>

如果没有重新加载页面,我无法更新我的数据,请建议我如何在没有页面重新加载的情况下更新 ui:repeat 数据。提前致谢。

【问题讨论】:

    标签: jsf primefaces


    【解决方案1】:

    试试这个:

    <h:form>
        <h:panelGroup id="toUpdate">
            <ui:repeat value="#{data.value}" var="tes" >
                #{tes.name}
            </ui:repeat>
        </h:panelGroup>
    
        <h:inputText value=#{data.name}/>
        <p:commandButton actionListener="#{data.addname()}" update="toUpdate"/>
    </h:form>
    

    【讨论】:

      猜你喜欢
      • 2010-12-22
      • 2015-10-09
      • 2016-12-26
      • 2011-04-07
      • 2021-07-17
      • 1970-01-01
      • 2014-04-12
      • 2017-06-27
      • 1970-01-01
      相关资源
      最近更新 更多