p:commandButton在p:dataScroller中的操作仅在第一个按钮上调用

时间:2015-08-11 11:56:52

标签: jsf primefaces commandbutton datascroller

在p:dataScroller里面我得到了一个带有inputTextarea和commandButton的表单:

<h:form>
    <p:inputTextarea rows="4" cols="15" autoResize="false" value="#{feedBean.comment}" />
    <br />
    <p:commandButton value="Kommentar posten" action="#{feedBean.commentStatus(entry.id)}" />                                               
</h:form>

当我点击第一个按钮时,一切正常。当我尝试单击第二个或第三个按钮时,不会调用该方法。我也尝试使用f:param,但它也不起作用。

这是方法commentStatus:

public String commentStatus(String id) {
    /* Irrelevant code */

    System.out.println("###entryId: "+id);

    /* Irrelevant code */

    return NavigationBean.securedFeedLink;
}

编辑:我自己找到了解决方案。我必须在我的按钮上添加process="@form"。现在它工作正常!

编辑2:我的表单已嵌套到另一个表单中,这就是我需要process="@form"的原因 我更新了我的代码并删除了另一个表单。现在它无需添加process="@form"

1 个答案:

答案 0 :(得分:0)

我自己找到了解决方案。我必须在我的按钮上添加process="@form"。现在它工作正常!