在< rich:modalPanel>中通过动作 [英] Passing action in <rich:modalPanel>

查看:126
本文介绍了在< rich:modalPanel>中通过动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<rich:modalPanel>中有一些传递动作的方法.我想使用是"和否"按钮编写简单的弹出窗口,并且希望在不同页面中重复使用此弹出窗口,这就是为什么我需要在按下是"按钮时调用不同的动作.有一种方法可以用<a4j:actionparam><rich:modalPanel>中传递一些值:

There is some way to pass action in <rich:modalPanel>. I want to write simple popup with "Yes" and "No" button, and I want to reuse this popup in different pages, that's why I need that different action was invoked when "Yes" button pressed. There is a way to pass some value in <rich:modalPanel> with <a4j:actionparam>:

<a4j:commandButton value="See details…" id="det"
    reRender="popup_dataIdField, …">

    <rich:componentControl for="popup"
        operation="show" event="onclick" />

    <a4j:actionparam name="message" assignTo="#{popupBean.message}"
        value="#{myBean.message}" />                                        
</a4j:commandButton>

但是有采取行动的方法吗?

But is some way to pass action ?

推荐答案

我自己找到了答案:).也许对某人会有帮助.

I find the answer by myself :). Maybe it will be helpful for somebody.

我已经使用Facelets完成了此操作.当我在页面中包含弹出窗口时,我会将参数传递给它:

I've done this using Facelets. When I'm include popup to my page I pass parametr to it:

            <ui:include src="./WEB-INF/popup/popup.xhtml">
                <ui:param name="yesAction" value="${thisPageBean}" />
            </ui:include>  

thisPageBean-是从弹出窗口中调用的bean.

Where thisPageBean - is bean from what popup invoked.

然后在我的弹出窗口中,我写道:

Then in my popup I wrote:

 <a4j:commandButton id="yesButton" value="#{msgs.yesButton}"
                     action="#{yesAction.someAtion}"
 </a4j:commandButton>

然后我调用thisPageBean.someAtion.所有的魔法都是${thisPageBean},这对我们$是必需的,而对于#则不是.

And with this I invoke thisPageBean.someAtion. All magic is ${thisPageBean}, it's is necessary to us $ but no #.

这篇关于在&lt; rich:modalPanel&gt;中通过动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆