setPropertyActionListeners到复合组件 [英] setPropertyActionListeners to composite component

查看:143
本文介绍了setPropertyActionListeners到复合组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建包含两个h:commandLinks的复合组件。我想从客户端代码传递f:setPropertyActionListeners应用于两个commandLinks。这有可能吗?我尝试使用cc:insertChildren,但未触发适当的设置器。

I need to create composite component containing two h:commandLinks. And i want to pass f:setPropertyActionListeners from the client-code to be applied to both two commandLinks. Is this ever possible? I tried to use cc:insertChildren, but appropriate setters are not being fired.

<my:operationLink action="#{cc.attrs.bean.myAction}">
 <f:setPropertyActionListener for="<!-- whats here? -->" value="#{cc.attrs.someAttrOne}" target="#{cc.attrs.bean.someAttrTargetOne}"/>
 <f:setPropertyActionListener for="<!-- whats here? -->" value="#{cc.attrs.someAttrTwo}" target="#{cc.attrs.bean.someAttrTargetTwo}"/>

和我的组件:

<cc:implementation>
<h:commandLink id="textLink" value="myTextLink"><ui:insert/></h:commandLink>
<h:commandLink id="imgLink"><h:graphicImage url="/images/my.gif"/><ui:insert/></h:commandLink>

我需要将动作监听器应用于这两个链接(进入ui:insert)

i need to apply actionlisteners to both links ( into ui:insert)

推荐答案

您需要声明 < cc:actionSource> 中,在名称中带有事件名称(例如 actionEvent ),这对于您完全是任意的选择)以及这些命令的客户端ID链接在目标中的空格中。

You need to declare a <cc:actionSource> in the composite interface with the "event name" in name (e.g. actionEvent, this is fully arbitrary to your choice) and the client IDs of those command links space separated in the targets.

<cc:interface>
    <cc:actionSource name="actionEvent" targets="textLink imgLink" />
</cc:interface>

然后您可以在客户端中使用:

Then you can use in the client:

<f:setPropertyActionListener for="actionEvent" ... />

别忘了删除< ui:insert> 。确实,这绝对不是正确的方法。

Don't forget to remove <ui:insert>. This is indeed definitely not the right way.

这篇关于setPropertyActionListeners到复合组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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