【问题标题】:Richfaces 4 a4j:commandLink action not firing in rich:popupPanelRichfaces 4 a4j:commandLink 操作未在 Rich:popupPanel 中触发
【发布时间】:2011-10-17 17:23:17
【问题描述】:

我似乎遇到了一个问题,我在 rich:popupPanel 上有一个 a4j:commandLink 但操作没有触发。 xhtml 如下所示:

<rich:popupPanel id="rate-panel" modal="true" height="444" width="780" top="60" show="false" onmaskclick="#{rich:component('rate-panel')}.hide()" styleClass="cs-modal">
  /**Some html here**/    
  <a4j:commandLink immediate="false" action="#{venueScore.up}" render="rate-panel" styleClass="rate love">
    <span>Love it</span>
  </a4j:commandLink>    
  /**Some more html here**/    
</rich:popupPanel>

托管 bean 如下所示:

@Named("venueScore")
@ViewScoped
public class VenueScoreManager extends BaseManager implements Serializable {
  public void up() {
    System.out.println("TEST");
    //Do something
  }
}

我已经创建了托管 bean @ViewScoped。

我也尝试在 commandLink 周围添加一个&lt;h:form&gt;,但是,这甚至比没有它的情况还要少。我实际上认为这是因为 commandLink 位于打开 popupPanel 的链接所在的&lt;h:form&gt; 内。

无论如何,有人可以指出为什么动作不触发的方向吗?

【问题讨论】:

    标签: jsf-2 richfaces cdi jboss-weld commandlink


    【解决方案1】:

    好的,所以我自己修好了。在搞砸之后,我发现我只需要在&lt;rich:popupPanel&gt; 的内容周围添加一个&lt;a4j:region&gt;。所以现在 xhtml 看起来像这样:

    <rich:popupPanel id="rate-panel" modal="true" height="444" width="780" top="60" show="false" onmaskclick="#{rich:component('rate-panel')}.hide()" styleClass="cs-modal">
      <a4j:region id="panel-region">
        /**Some html here**/    
        <a4j:commandLink immediate="false" action="#{venueScore.up}" render="panel-region" styleClass="rate love">
          <span>Love it</span>
        </a4j:commandLink>    
        /**Some more html here**/    
      </a4j:region>
    </rich:popupPanel>
    

    【讨论】:

    • 你无法相信我花了多少时间试图找到这个答案!您是如何找到这个解决方案的?
    • @AmrH.AbdelMajeed - 我可能花的时间和你一样多。我认为最终的反复试验解决了它;)
    【解决方案2】:

    我知道这是一个老问题,但由于我遇到了完全相同的问题,我花了很多时间才解决它,也许它会对其他人有所帮助。 首先,我尝试了上面提出的解决方案,但没有奏效。 最后,我找到了这个线程: Issues closing rich:popupPanel via show condition, RF 4.0

    我在弹出窗口中添加了 domElement 属性:

    <rich:popupPanel 
    id="newMailPopup" 
    **domElementAttachment="form"** 
    ...>
    

    现在,我的 a4j:commandLink 完美运行 :-)

    【讨论】:

      【解决方案3】:

      我遇到了同样的问题,a4j:commandLink 只有在第一次点击后才能工作....将弹出面板放入表单并添加 domElementAttachment...

      <h:form id="myform">
          <rich:popupPanel id="pop" domElementAttachment="form">
              ...
              <a4j:commandLink />
              ...
          </rich:popupPanel>
      </h:form>
      

      【讨论】:

        猜你喜欢
        • 2012-04-12
        • 2013-12-19
        • 2012-10-01
        • 2019-07-23
        • 1970-01-01
        • 1970-01-01
        • 2021-07-30
        • 2014-09-18
        • 2014-04-20
        相关资源
        最近更新 更多