Jsf 2 Richfaces 4 a4j:commandLink操作未在rich:popupPanel中触发
我似乎遇到了一个问题,在rich:popupPanel上有一个a4j:commandLink,但动作没有触发。xhtml如下所示:Jsf 2 Richfaces 4 a4j:commandLink操作未在rich:popupPanel中触发,jsf-2,richfaces,cdi,jboss-weld,commandlink,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
<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>
@Named("venueScore")
@ViewScoped
public class VenueScoreManager extends BaseManager implements Serializable {
public void up() {
System.out.println("TEST");
//Do something
}
}
我已经在@viewscope中创建了托管bean
我还尝试在commandLink周围添加一个
,但是,这比没有它的效果还要差。我实际上认为这是因为commandLink位于打开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>
/**这里有一些html**/
喜欢它
/**这里有更多的html**/
我知道这是一个老问题,但由于我遇到了完全相同的问题,我在修复它之前花了很多时间,也许它会帮助其他人。
首先,我尝试了上面提出的解决方案,但没有成功。
最后,我找到了这个线索:
我在弹出窗口中添加了DomeElement属性:
<rich:popupPanel
id="newMailPopup"
**domElementAttachment="form"**
...>
现在,我的a4j:commandLink工作得很好:-)我也遇到了同样的问题,a4j:commandLink只在第一次单击后才工作。。。。将poppanel放入表单中并添加domElementAttachment
<h:form id="myform">
<rich:popupPanel id="pop" domElementAttachment="form">
...
<a4j:commandLink />
...
</rich:popupPanel>
</h:form>
...
...
你无法相信我花了多少时间试图找到这个答案!你是如何找到这个解决方案的?@AmrH.AbdelMajeed-我可能和你花了同样多的时间。我认为反复试验最终解决了它;)