xhtml 中的 JSF 条件 AJAX 替代 JSTL

JSF condition in xhtml with AJAX alternative to JSTL

JSF 中 JSTIL 的替代品是什么。我想在 AJAX.

的 xhtlm 中有一个条件
<p:commandButton id="button" value="Send">                                   
         <f:ajax event="click"  listener="#{messageControler.wniosekWyslany()}"/> 
         <f:ajax event="click"  listener="#{messageControler.wniosekNieWyslany()}"/> 
</p:commandButton>

第一个 ajax 应该是当 boolean = true,second false 时的动作。我的 bean return 布尔值,所以基于它很好,但我不知道如何。我测试了 JSTL,但在 JSF 中它不能正常工作。

这是业务逻辑,不应在视图中完成。创建一个 ajax 侦听器并在 bean

中执行 if/then

xhtml:

<p:commandButton id="button" value="Send">                                   
         <f:ajax event="click"  listener="#{messageControler.doSend()}"/> 
</p:commandButton>

豆子:

public void doSend() {
   if (myBoolean) {
      wniosekWyslany();
   else {
    wniosekNieWyslany();
   } 
}