複合コンポーネント内で動的 JSF 属性をネストするのに苦労しています。
クライアント側で次の構造を想像してみましょう。
class BackingBean{
Animal animal;
}
class Animal {
Type type;
}
class Type{
String name;
}
.
ビュー側では、文字を使用してネストされたフィールドに到達できます。
#{backingBean.animal.type.name}
その場合、すべてが魔法のように機能します。composite component
それを書き直し、ネストさfields
れたものを別のものとして表現したいときに問題が発生しますattributes
:
<cc:interface>
<cc:attribute name="mainAttribute"/>
<cc:attribute name="nestedAttribute"/>
<cc:attribute name="valuesProviderService"/>
</cc:interface>
<cc:implementation>
<f:selectItems value="#{cc.attrs.valuesProviderService.findAnimals}"
var="animal" itemValue="#{animal}" itemLabel="#{$HERE_IS_NESTING$}" />
</cc:implementation>
さまざまなアプローチを試みましたが、現在の知識では解決できないと思います。
[
次のような文字でネストを使用しようとしました:
itemLabel="#{animal[cc.attrs.mainAttribute[cc.attrs.nestedAttribute]]}"
も試してみましたc:set
<c:set var="main" value="#{cc.attrs.mainAttribute}" />
<c:set var="nested" value="#{cc.attrs.nestedAttribute}" />
そしてそれを使うitemLabel="#{animal.main.nested}"
私が達成したいことをあなたが知っていることを願っています。ここで少し手伝ってくれませんか?