mojarra icon indicating copy to clipboard operation
mojarra copied to clipboard

Nested <ui:include> of template <ui:composition>

Open nonono-n opened this issue 7 years ago • 0 comments

I want to create a shared template file, and two composition file refering the shared template file. Besides a main file includes the composition_1 file, and the composition_1 file includes the composition_2 file.

I think the correct result of following sample is [component_1.xhtml insert-1] [component_2.xhtml insert-1] [component_2.xhtml insert-2] [component_1.xhtml insert-2]

but I got this result. [component_1.xhtml insert-1] [component_2.xhtml insert-1] [component_1.xhtml insert-2] -> ? [component_1.xhtml insert-2]

It is seemed the composition_2 file's <ui:define name="insert-2"> is ignored. Is this correct result?

thank you.

Mojarra version 2.2.13.SP4

(1) main.xhtml

<h:head>
    <title>test</title>
</h:head>

<h:body>
    <ui:include src="/test/composition_1.xhtml" />
</h:body>

(2) template.xhtml <ui:component xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

<ui:insert name="insert-1">[template.xhtml insert-1]</ui:insert>

<br />

<ui:insert name="insert-2">[template.xhtml insert-2]</ui:insert>

<br />

</ui:component>

(3) composition_1.xhtml <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" template="/test/template.xhtml" >

<ui:define name="insert-1">

    [component_1.xhtml insert-1]
    
    <br />
    <ui:include src="/test/composition_2.xhtml" />
    
</ui:define>

<ui:define name="insert-2">

    [component_1.xhtml insert-2]
    
</ui:define>

</ui:composition>

(4) composition_2.xhtml <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" template="/test/template.xhtml" >

<ui:define name="insert-1">

    [component_2.xhtml insert-1]
    
</ui:define>

<ui:define name="insert-2">

    [component_2.xhtml insert-2]
    
</ui:define>

</ui:composition>

nonono-n avatar May 11 '18 10:05 nonono-n