I’m facing an issue with rendering content passed through facets in nested composite components. Despite the facets being recognized as not empty, the content inside these facets does not appear on the final page. Below are the relevant parts of my implementation:
- draft_scenario_details.xhtml
<ui:composition template="/virets/templates/base_template.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:virets="http://java.sun.com/jsf/composite/composite">
<ui:define name="content">
<virets:scenarioDetails>
<f:facet name="additionalButtons">
<p:outputLabel value="MY DRAFT"/>
</f:facet>
</virets:scenarioDetails>
</ui:define>
</ui:composition>
- scenarioDetails.xhtml
<ui:composition
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:virets="http://java.sun.com/jsf/composite/composite">
<cc:interface>
<cc:facet name="additionalButtons"/>
</cc:interface>
<cc:implementation>
<virets:scenarioDetailsData>
<f:facet name="additionalButtonsFacet">
<cc:renderFacet name="additionalButtons"/>
</f:facet>
</virets:scenarioDetailsData>
</cc:implementation>
</ui:composition>
- scenarioDetailsData.xhtml
<ui:composition
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:p="http://primefaces.org/ui">
<cc:interface>
<cc:facet name="additionalButtonsFacet"/>
</cc:interface>
<cc:implementation>
<cc:renderFacet name="additionalButtonsFacet"/>
</cc:implementation>
</ui:composition>
Issue:
The label “MY DRAFT” passed via the “additionalButtons” facet in viretsScenarioDetails should render in scenarioDetailsData, but it doesn’t appear on the page.
What I have tried:
- Ensuring facet names are consistent across components.
- Directly rendering the facet in intermediate components to verify its presence.
Question:
How can I ensure that the content passed through facets in nested JSF composite components renders correctly in the final output?
Any help or insights would be greatly appreciated!