5

我似乎遇到了一个问题,我在 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。

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

无论如何,有人可以指点我为什么动作不火的方向吗?

4

3 回答 3

8

好的,所以我自己修好了。在搞砸之后,我发现我只需要<a4j:region><rich:popupPanel>. 所以现在 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>
于 2011-08-02T07:17:49.810 回答
1

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

<h:form id="myform">
    <rich:popupPanel id="pop" domElementAttachment="form">
        ...
        <a4j:commandLink />
        ...
    </rich:popupPanel>
</h:form>
于 2014-07-12T16:15:40.007 回答
0

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

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

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

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

于 2013-08-01T08:15:41.823 回答