Primefaces号码:阿贾克斯监听条件更新号码、条件、Primefaces、阿贾克斯

2023-09-10 22:01:10 作者:少年你可曾听说.

JSF页面:

<p:commandButton>
  <p:ajax process="@this" update="name desc msg"
    listener="#{bean.deleteListener}"/>
</p:commandButton>

豆:

public void deleteListener() {
  if (data.size() == 0) {
    // updates only "msg"
    setMsg("There is no data to delete");
    return;
  }
  setMsg("Data deleted.");
  // and updates the bean values for "name" and "desc" also.
  ...
}

是否有可能基于AJAX的监听器逻辑Ajax调用有条件地更新。我想更新客户端ID名递减味精有条件的,如下面的听众code所示(请注意这是一个更大的应用程序中的示例场景)。该应用程序使用Primefaces 5.感谢。

Is it possible to conditionally update for an ajax call based on ajax listener logic. I would like to update the client ids "name desc msg" conditionally as shown in the listener code below (note this is a sample scenario in a larger application). The application uses Primefaces 5. Thanks.

推荐答案

@Kukeltje:感谢您的答复。但是,没有解决不了的问题。我曾尝试这一点,并找到其他的解决方案相关的网络论坛primefaces / AJAX /有条件的更新;他们并不适用于阿贾克斯听众的问题我已经张贴在这个岗位。我已经通过一些其他的手段/解决方法解决了问题。

@Kukeltje: Thanks for the reply. But, that did not solve the issue. I did try this and other solutions found online forums related to primefaces/ajax/conditional updates; they did not apply to the ajax listener issue I had posted in this post. I have resolved the issue through some other means/workaround.