Is there a rule on how to overwrite template definitions <ui:define>
with <ui:insert>
.
Template A:
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets">
template A content<br/>
<ui:insert name="content"/>
</ui:composition>
Template B:
<ui:composition template="/resources/templates/A.xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:define name="content">
template B content<br/>
<ui:insert name="content"/>
</ui:define>
</ui:composition>
Site 1:
<ui:composition template="/resources/templates/B.xhtml">
Site 1<br/>
<ui:define name="content">
site content<br/>
</ui:define>
</ui:composition>
Output:
Site 1
site content
Content for the <ui:define>
is taken from Site 1, the content of the templates is not rendered.
Site 2:
<ui:composition template="/resources/templates/B.xhtml">
Site 2<br/>
</ui:composition>
Output:
Site 2
template B content
template A content
Content for the <ui:define>
is taken from template B and template A, where strangely template B content is rendered before content of template A.
Is it possible to overwrite <ui:define>
with a new <ui:insert>
using same name?
Creating new names for the nested <ui:insert>
is one possibility but its hard to keep track of the hierarchy and where insert's are used at all.