【问题标题】:a4j:commandButton does not invoke actiona4j:commandButton 不调用动作
【发布时间】:2015-09-04 12:50:14
【问题描述】:

我正在尝试将 jsf 1.x richfaces 3.x 应用程序迁移到 jsf2.x 和 richfaces 4.x。我在一个表单中有一个richpopupPanel,它有一个表单和两个a4j:commandButtons。我无法在第二个按钮上调用操作来提交表单。

代码如下。

<h:form id="outsideform">
     <rich:popupPanel id="details" domElementAttachment="form">
      <f:facet name="header">
            <h:outputText value="PopuPTitle" style="text-align: center;" styleClass="center"/>
        </f:facet> 
       <a4j:commandButton id="firstButton" render = "detailsform" action="#{mybean.getDetails()}"/> 

         <h:form id="detailsForm>

           content to be submitted

        <a4j:commandButton id ="secondButton" action ="#{mybean.action()}"  render="addContent"/>

        </h:form>
        </rich:popupPanel>

detailsForm 在点击 firstButton 时成功呈现,但是当对内容进行一些更改并尝试通过点击 secondButton 提交时> secondButton 上的操作不会被调用。要提交的表单是 detailsForm

【问题讨论】:

  • 正如@BalusC 在this answer 中所说。当您管理分层或依赖数据时,您不必构建分层表单结构。
  • @lametaweb 感谢您的回复,您能告诉我如何解决这个问题,因为我必须走这条路,因为我在弹出窗口之外有rich:tabPanel,需要一个围绕它的表单。 .
  • 它也是一个seam应用程序,seam 2.3是版本

标签: jsf-2 richfaces jboss6.x


【解决方案1】:

不要使用嵌套的h:forms。将“details”popupPanel 移到“outsideform”表单之外。

【讨论】:

  • 您的回答有效,并且支持 bean 也存在问题,现在一切都已解决,感谢您的时间和帮助。
【解决方案2】:

删除&lt;h:form id="detailsForm&gt;并为第二个按钮添加process="details"属性。

【讨论】:

  • 将 popupPanel 放在表单之外。实际上,backing bean也存在问题,所以没有被调用,现在一切都解决了。非常感谢您的时间和帮助。
  • @Vinay G B 你必须接受另一个答案,Vasil Lukach 的答案,而不是我的答案。
  • 我使用a4j:region 组件找到了另一种可能的解决方案。查看 Rich Faces 展示网站上的 this page。示例源代码中的第 32 行并转发。
  • 是的,我做了类似的事情,现在它正在工作,再次感谢。
猜你喜欢
  • 2013-05-25
  • 1970-01-01
  • 1970-01-01
  • 2014-09-16
  • 1970-01-01
  • 1970-01-01
  • 2012-04-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多