【发布时间】:2018-07-01 03:52:42
【问题描述】:
我有一个复合组件:
<composite:interface componentType="myCC">
<composite:attribute name="tempId" required="false"/>
<composite:attribute name="action" targets="??????" required="false"/>
</composite:interface>
<composite:implementation>
<p:commandButton id="#{cc.attrs.tempId}button"
action="#{cc.attrs.action}"/>
</composite:implementation>
此外 - 我有两个使用它的组件 -
<span id="firstSpan">
<sm:myCC id="fooid1" tempId="inFirstSpan"
action="#{firstController.method('String')}"/>
</span>
<span id="secondSpan">
<sm:myCC id="blaid1" tempId="inSecondSpan"
action="#{secondController.method('String')}"/>
</span>
问题是,我尝试使用 targets 中的 id 但失败了。
在这种情况下我该如何实现?
【问题讨论】:
-
为什么需要#{cc.attrs.tempId}?只需摆脱它并在复合的上下文中思考(忽略客户端),一切都会自己指出。
-
嗨@BalusC,首先-感谢您的评论。到现在为止,
commandButtonid 只是"button"- 这很好用。但是我们的客户要求我们根据包装它的span更改commandButtonid,而不更改“clientId”。有可能吗?