Question

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:implementation>
    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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top