1

JSF スニペットの機能を理解しようとしています。それはこのようなものになります

<composite:interface>
    <composite:attribute name="field" />
    <composite:attribute name="value" default=""/>
    [...]
</composite:interface>
<composite:implementation>
     <ui:fragment rendered="some_logic_here">
         <h:outputText value="#{cc.attrs.value}">
             <f:attribute name="value" value="#{cc.attrs.field.value}"/>
         </h:outputText>
     </ui:fragment>
</composite:implementation>

このfield属性は、アクセサー (文字列用)beanを持つメンバーを参照します。属性は、別の場所から取得した文字列ですgetValue() / setValue()value

私が理解していることから、outputの値は最初に (静的)value属性:に設定されvalue="#{cc.attrs.value}"、次に<f:attribute>タグは「フィールド」Bean から取得した「動的」値に何かを設定します。

これはどのように機能しますか?「動的」値は静的値をオーバーライドしますか? いつも?

4

1 に答える 1

4

As you guessed, this does indeed exactly the same as:

<h:outputText value="#{cc.attrs.field.value}" />

In other words, the original developer didn't thought out it very well, or was fiddling until it started to work like magic, or perhaps had a short on coffee, or smoked something bad while developing.

于 2013-08-14T12:53:14.410 に答える