a4j:commandButton的动作永远不会被触发,因为它位于带有渲染标记的rich:面板中

时间:2013-11-06 09:05:38

标签: jsf richfaces ajax4jsf

以下是我的xhtml代码的简化版本,我无法弄清楚为什么我的 save1 commandButton在 save2 工作时不起作用:

   <rich:panel id="table_panel">
    <h:form>
    <rich:panel rendered="#{bean.showPanel}">
        <a4j:commandButton id="save1" value="Save" 
            action="#{bean.executeAction()}">
       </rich:panel>
       <rich:panel>
        <a4j:commandButton id="save2" value="Save2" 
            action="#{bean.executeAction()}">
       </rich:panel>
      </h:form>
    </rich:panel>

单击按钮时,它会在后端将 showPanel 值更新为 true 并重新渲染* table_panel *, 然后将显示commandButton save1 ,但即使它出现,操作 executeAction() 点击后永远不会被调用(永远不要在方法中输入我的断点)。但是,命令按钮 save2 始终可以正常运行。

这两个按钮的唯一区别是它们的包装器丰富:面板,一个总是在那里 在一些UI操作之后显示另一个,因为它具有 rendering =“#{bean.showPanel}”属性。我在firebug上没有看到任何javascript错误。

我很感激任何想法,提前谢谢!

2 个答案:

答案 0 :(得分:1)

尝试在commandButton中明确地输入execute =“@ this”。

答案 1 :(得分:1)

您是否尝试过immediate="true",我认为这可能会缩小问题的范围:

<a4j:commandButton id="save1" value="Save" immediate="true"
    action="#{bean.executeAction()}">