第二次不调用JSF呈现方法

时间:2015-06-29 09:26:49

标签: jsf jsf-2 richfaces

我接下来有a4j:jsFunction

<a4j:jsFunction name="renderOnBusinessErrorEvent" execute="@none" bypassUpdates="true" immediate="true"
            render="securityForm">
        </a4j:jsFunction>

和JSF表单中有一些对话框

<h:form id="securityForm">
      <h:panelGroup rendered="#{someCondition}">
      ......
      </h:panelGroup>
    </h:form>

在我的业务逻辑中,它必须执行两次。第一次一切都很好。调用渲染方法并在页面上显示预期的对话框。在第二次渲染方法没有被调用,但模型已被更改,我希望页面上不会出现对话框。我认为这是一些丰富的问题​​,我试图使用f:ajax

<a4j:jsFunction name="renderOnBusinessErrorEvent" execute="@none" bypassUpdates="true" immediate="true">
            <f:ajax event="begin" render=":securityForm"/>
        </a4j:jsFunction>

但未成功。仍未在第二次调用渲染方法。它是什么?一些JSF优化还是bug?解决方法是什么? JSF版本2.1.19

1 个答案:

答案 0 :(得分:0)

问题发生在<h:panelGroup rendered="#{someOtherCondition}"> over h:在第一次渲染后等于false的形式(在服务器端)。 但是,此panelGroup不是渲染的一部分。所以,我的代码:

<h:panelGroup rendered="#{someOtherCondition}">
    <h:form id="securityForm">
          <h:panelGroup rendered="#{someCondition}">
          ......
          </h:panelGroup>
     </h:form>
</h:panelGroup>
<h:form>
    <a4j:jsFunction name="renderOnBusinessErrorEvent" execute="@none" bypassUpdates="true" immediate="true"
            render="securityForm">
    </a4j:jsFunction>
</h:form>

在调用renderOnBusinessErrorEvent()之前,我将someOtherCondition的值从true更改为false,但我不会重新呈现此元素。实际上,在服务器端,此元素已丢失。看起来它是JSF功能,但它是否在某处特定?

相关问题