p:commandButton上update属性的多个值

时间:2016-02-10 13:58:55

标签: jsf primefaces spring-webflow

我是Primefaces的新手,我想知道我是否可以在primefaces commandButton组件上使用两个值进行属性更新:

我的代码

<p:messages id="messages" ...../><!-- not always updated -->
<h:form>
    ...
    <p:commandButton ....action="search" update="@all :messages"/>
    ..
</h:form>
<h:form>
    <p:panel header="Number of element in the the table:#{bean.number}">
        <!--not always updated -->
        <p:datatable>
            <!-- always updated -->
        </p:datatable>
    </p:panel>
</h:form>

当我这样做时,面板组件的标题不会更新。

当我只放update="@all"时,即使使用p:messages

,消息组件(autoUpdate="true")也不会更新

你能帮帮我吗?

1 个答案:

答案 0 :(得分:-1)

不要使用@all,这是不好的做法(http://forum.primefaces.org/viewtopic.php?f=3&t=6956#p36841)。

如果要更新特定组件或表单,可以使用jQuery选择器:PFS (PrimeFaces Selectors) - Showcase

因此,您可以在第二个表单上放置一个id并在update属性中指定它。

相关问题