Richfaces 4 a4j:commandLink操作未在rich:popupPanel中触发

时间:2011-08-01 19:39:00

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

我似乎遇到一个问题,我在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周围添加<h:form>但是,这比没有它的情况更少。我实际上认为这是因为commandLink位于打开popupPanel的链接所在的<h:form>内。

无论如何,有人可以指出我为什么行动不开火的方向?

3 个答案:

答案 0 :(得分: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>

答案 1 :(得分:0)

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

我将domElement属性添加到弹出窗口中:

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

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

答案 2 :(得分:0)

我有同样的问题,a4j:commandLink 仅在首次点击后才能工作 ....将poppanel放入表单并添加domElementAttachment ...

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