Omar Al Kababji
Omar Al Kababji

Reputation: 1828

Composite component action attribute reutilization?

I have a JSF 2.0 composite component as follows:

<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>

as you can see for now I am using two different attributes named (action1, action2) and target them to the two commandLink's.

what I would like to do is: instead of having action1 & action2, I would like to have only one attribute named "action" and reuse this action for both commandLinks.

Thanks.

Upvotes: 0

Views: 1107

Answers (1)

BalusC
BalusC

Reputation: 1109222

You can specify a space separated list of client IDs in targets attribute. See also the <composite:attribute> tag documentation:

If this element has a method-signature attribute, the value of the targets attribute must be interpreted as a space (not tab) separated list of client ids (relative to the top level component) of components within the <composite:implementation> section.

Upvotes: 1

Related Questions