【问题标题】:richfaces a4j:support event unexpected calling backend methodsrichfaces a4j:支持事件意外调用后端方法
【发布时间】:2012-07-11 14:10:47
【问题描述】:

我使用 Richfaces 3.3 开发 JSF 1.2 应用程序。我有一个包含rich:extendedDataTable 的弹出窗口。当我单击表中的一行时,我想启用或禁用一个按钮,我使用a4j:support event="onRowClick"

这里有一些代码:

<h:form>
    <rich:panel id="main">
        <a4j:commandButton id="completed" value="Completed" 
        rendered="#{bean.completedCase}" />

        <a4j:commandButton  value="Open"
                oncomplete="#{rich:component('popupId')}.show(...)">
        </a4j:commandButton>

        <rich:modalPanel id="popupId">
            <a4j:region>

                <rich:extendedDataTable id="source" value="#{bean.sourceItems}" 
                    var="sourceItem" selectionMode="single" >
                    <a4j:support event="onRowClick" eventsQueue="pickQueue" reRender="copy" >
                        <f:setPropertyActionListener value="#{sourceItem}"
                            target="#{bean.sourceSelection}" />
                    </a4j:support>
                    ....
                </rich:extendedDataTable>           

                <a4j:commandButton id="copy" value="Copy" />
            </a4j:region>

            <a4j:commandButton value="Ok" reRender="completed"
                    oncomplete="#{rich:component('popupId')}.hide();return false;">
            </a4j:commandButton>

        </rich:modalPanel>
    </rich:panel>
</h:form>

问题是,当我单击一行时,在后端调用了一些用于呈现按钮的方法:rendered="#{bean.completedCase}",但该按钮不在弹出窗口上,而是在弹出窗口之外的页面上。知道为什么要调用其他方法而不是用于表格的方法吗?

【问题讨论】:

    标签: richfaces jsf-1.2 ajax4jsf richfaces-modal


    【解决方案1】:

    尝试在您的a4j:support 标签上使用ajaxsingle="true"。由于您在 onrowclick 触发请求时使用h:form,因此在更新模型阶段,h:form 中的所有组件都将在服务器上进行处理。

    希望这会有所帮助。

    【讨论】:

    • ajaxSingle="true" 对我没有帮助,因为我想处理一些其他组件。
    • 你可以在你的a4j:support标签中使用进程属性,然后列出你想要处理的所有组件。
    【解决方案2】:

    不建议嵌套&lt;h:form&gt;s,但我们可以有多个&lt;h:form&gt;s,试试 修改您的代码,使&lt;h:commandButton&gt; 在一个h:form 中,而&lt;h:modalPanel&gt; 在另一种形式中

    希望这会有所帮助。你也可以试试&lt;a4j:form&gt;modalPanel

    【讨论】:

      猜你喜欢
      • 2012-07-18
      • 1970-01-01
      • 2012-06-28
      • 1970-01-01
      • 2011-04-30
      • 1970-01-01
      • 1970-01-01
      • 2010-12-17
      • 2011-06-20
      相关资源
      最近更新 更多