复合组件操作属性重用度?

时间:2011-12-29 18:48:11

标签: 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.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&amp; action2,我想只有一个名为“action”的属性,并将这个动作重用于commandLinks。

感谢。

1 个答案:

答案 0 :(得分:1)

您可以在targets属性中指定以空格分隔的客户端ID列表。另请参阅the <composite:attribute> tag documentation

  

如果此元素具有方法签名属性,则targets属性的值必须解释为空格(不是制表符)分隔的客户ID列表(相对<composite:implementation>部分内的组件的顶层组件。

相关问题