开发者

Adding JSF UIComponent as composite component child renders nothing

I have a custom UIComponent, which renders ok when called directly from the base facelet template (I guess this makes it a direct child of UIComponentBodyTag). However, when it is called within a composite component, nothing happens. I get no exceptions, nothing. Everything else renders ok.

So while this works:

<h:body>
    <x:myUiComponent />
</h:body>

This doesn't work:

<h:body>
    <demo:uiComponentWrapper />
</h:body>

uiComponentWrapper.xhtml:

<cc:implementat开发者_StackOverflow中文版ion>
    Before [<x:myUiComponent />] After
</cc:implementation>

It prints simply as Before [] After.

By my logic, this should work. What am I missing? Running Mojarra 2.0.2.


It seems that UIComponent's encodeAll(...) is called when it is added to page normally. However, encodeBegin(...) is called instead, when component is being added as a child of a composite component. My component building was defined in encodeAll(...), which wasn't run when adding the component as a composite component child.

So it's just different in different contexts. For the reason, why it is so, see question about exactly that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜