【问题标题】:render of a4j commandButton doesnt work; page not renderinga4j commandButton 的渲染不起作用;页面未呈现
【发布时间】:2012-06-05 20:19:39
【问题描述】:

当我点击按钮 handler.toggleCreatingTheme() 被调用,但 outputPanel 没有呈现。当我刷新页面(f5)时,会显示面板的内容。

                <a4j:commandButton styleClass="simple-submit-button"
                    action="#{handler.toggleCreatingTheme()}"
                    rendered="#{!handler.creatingTheme}"
                    value="txt"
                    immediate="true"
                    render="newThemeForm" oncomplete="initEditor()" status="statusWait" />

                <a4j:outputPanel id="newThemeForm" ajaxRendered="true" rendered="#{handler.creatingTheme}">

这个标签都在一个 h:form 标签中,只有一个 h:form。

如何让页面自己刷新,在点击按钮的时候渲染面板?

【问题讨论】:

    标签: jsf ajax4jsf


    【解决方案1】:

    在另一个 a4j:outputPanel 中嵌入 newThemeForm 并渲染它而不是重新渲染 newThemeForm。这是因为 newThemeForm 在尝试渲染它时不会在 DOM 中,因为它的 rendered 属性仍然是 false . 喜欢:

    <a4j:outputPanel id="outerPanel>
    <a4j:outputPanel id="newThemeForm" rendered="#{bean.booleanvalue}">
    </a4j:outputPanel>
    </a4j:outputPanel>
    

    渲染 outerPanel 而不是 newThemeForm

    【讨论】:

      【解决方案2】:

      我已经尝试过 AhamedMustafaM 提到的方法,但它对我不起作用,所以我搜索并尝试了一段时间,所以最后我必须通过一种解决方法让它工作,这就是方法

      <a4j:commandButton id="clear" value="Clear" action="#{handler.clearData}"  immediate="true"  >
          <!-- dummy call just to make it work -->
          <a4j:actionListener listener="#{ViewerController.test}"/>
          <f:ajax render="dataGroupPanel"/>
      </a4j:commandButton> 
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-01-23
        • 2016-08-22
        相关资源
        最近更新 更多