Jsf 2 复合组件动作属性重用?

Jsf 2 复合组件动作属性重用?,jsf-2,composite-component,Jsf 2,Composite Component,我有一个JSF 2.0复合组件,如下所示: <composite:interface> <composite:attribute name="id"/> <composite:attribute name="action1" targets="#{cc.clientId}:#{cc.attrs.id}_1" requiered="true"/> <composite:attribute name="action2" targets="#{cc

我有一个JSF 2.0复合组件,如下所示:

<composite:interface>
  <composite:attribute name="id"/>
  <composite:attribute name="action1" targets="#{cc.clientId}:#{cc.attrs.id}_1" requiered="true"/>
  <composite:attribute name="action2" targets="#{cc.clientId}:#{cc.attrs.id}_2" requiered="true"/>
</composite:interface>

<composite:implementation>
  <h:commandLink id="#{cc.attrs.id}_1" value="command link 1"/>
  <h:commandLink id="#{cc.attrs.id}_2" value="command link 2"/>
</composite:implementation>

正如您现在看到的,我正在使用两个名为(action1,action2)的不同属性,并将它们定位到两个commandLink

我想做的是:与action1和action2不同,我只希望有一个名为“action”的属性,并对两个CommandLink重用此操作


谢谢。

您可以在
targets
属性中指定以空格分隔的客户端ID列表。另见:

如果此元素具有方法签名属性,则targets属性的值必须解释为
部分中组件的客户机ID的间隔列表(相对于顶级组件)