dynamic JSF composite component styling/rendering
- by Checkoff
I've a little problem with a composite component. This component's implementation looks like:
<composite:implementation>
<h:outputStylesheet name="foo.css" library="bar"/>
<div id="#{cc.clientId}">
<composite:insertChildren/>
</div>
</composite:implementation>
It is included dynamically into a facelet page which include this component with JSTL core tags. The facelet page is similar to the following one.
<h:panelGroup id="viewport" layout="block">
<c:if test="#{controller.object != null}">
<c:forEach items="#{controller.object.elements}" var="element">
<c:if test="#{element.type == 'type1'}">
<my:componentTypeOne id="#{element.id}"/>
</c:if>
<c:if test="#{element.type == 'type2'}">
<my:componentTypeTwo id="#{element.id}"/>
</c:if>
</c:forEach>
</c:if>
</h:panelGroup>
So when I only render the viewport of the page the components are rendered but without the stylesheet defined within the composite component my:component. Is there any way to include the stylesheet on the fly without rendering the whole page?
EDIT: extension of the example code..