2 つのカスタム コンポーネントがあります。
CustomUIComponent extends UIComponentBase
CustomChildUIComponent extends UIComponentBase
CustomUIComponent では、encodeBegin、encodeChildren、および encodeEnd を実装します。encodeChildren では、子コンポーネントに転送されるカスタム属性を設定します。
CustomChildUIComponent では、encodeBegin のみを実装しています。
これらのクラスに加えて、faces-config.xml に次のコンポーネントを追加しました。
<component>
<component-type>test.JsfMessage</component-type>
<component-class>test.CustomUIComponent</component-class>
</component>
<component>
<component-type>test.JsfChildMessage</component-type>
<component-class>test.CustomChildUIComponent</component-class>
</component>
そして、web.xml で構成されたカスタム taglib.xml があり、以下が含まれています。
<tag>
<tag-name>customMessage</tag-name>
<component>
<component-type>test.JsfMessage</component-type>
</component>
</tag>
<tag>
<tag-name>customChildMessage</tag-name>
<component>
<component-type>test.JsfChildMessage</component-type>
</component>
</tag>
最後に、実行しようとしている Facelets ページで:
<myns:customMessage message="Hello World!!!" var="mytestvar">
<myns:customChildMessage partnermsg="#{mytestvar}" />
</myns:customMessage>
その結果、親はレンダリングされますが、子コンポーネントはレンダリングされません。
私は何か間違ったことをしていますか?
私は super.encodeChildren をチェックしようとしましたが、それはチェックします:
Renderer renderer = getRenderer(context);
if(renderer != null) ...
私はレンダラー クラスを使用していませんが、必須ではないことを理解しています。