【问题标题】:Composite component action attribute reutilization?复合组件动作属性重用?
【发布时间】:2012-01-30 02:49:31
【问题描述】:

我有一个 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。

我想做的是:我希望只有一个名为“action”的属性,而不是有 action1 和 action2,并将这个动作用于两个 commandLink。

谢谢。

【问题讨论】:

    标签: jsf-2 composite-component


    【解决方案1】:

    您可以在targets 属性中指定以空格分隔的客户端ID 列表。另见the &lt;composite:attribute&gt; tag documentation

    如果此元素具有方法签名属性,则目标属性的值必须解释为 空格(不是制表符)客户端 ID 的分隔列表(相对&lt;composite:implementation&gt; 部分中的组件的顶级组件)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-13
      • 2021-10-04
      • 1970-01-01
      • 2014-05-10
      • 2013-12-01
      • 2011-06-02
      相关资源
      最近更新 更多