[ 
https://issues.apache.org/jira/browse/MYFACES-2753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12887905#action_12887905
 ] 

Leonardo Uribe commented on MYFACES-2753:
-----------------------------------------

Ok, It is a typo error. Really I was thinking on the "stack" so I'll rewrite it:

"... The current algorithm makes ui:decorate that renders template2.xhtml has 
precedence over the one rendering template1.xhtml. But if you change 
ui:decorate from  pushClient to extendClient, the opposite becomes true, the 
outer one will have precedence over the inner one ..."

That's what I want to say, right?

Let's take a look at this afirmation:

"...The problem was that CompositionHandler used extendClient(this) instead of 
pushClient(this)...."

an take this example:

<ui:decorate template="/templates/template1.xhtml"> 
    <!-- ... Some code here -->
</ui:decorate> 

template1.xml
<ui:composition template="/templates/template2.xhtml">
    <!-- ... Some code here -->
</ui:composition>

If you change CompositionHandler to use pushClient(this), then ui:decorate will 
not work, because the first one to be resolved is ui:composition.

Now, do you see the consequences? The summary I did looks simple, even the code 
looks simple, but it is not. Its simplicity hides the real "heart" of facelets. 
That's why I said at start:

"....The important to keep in mind here is the "precedence", in other words, 
which TemplateClient should be applied first. ....."

Only if you really understand the code and make a lot of step by step 
debugging, you can imagine how it works and see "the real intention" of the 
author.

> Trivial multi-level templating does not work if ui:include is used
> ------------------------------------------------------------------
>
>                 Key: MYFACES-2753
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2753
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.2-SNAPSHOT
>         Environment: myfaces core trunk (2.0.2-SNAPSHOT), tomcat 6.0.26
>            Reporter: Martin Kočí
>            Assignee: Jakob Korherr
>         Attachments: MYFACES-2753-tests.patch, MYFACES-2753.patch, 
> MYFACES-2753.tar.gz
>
>
> Following example does not produce any output:
> OuterClient.xhtml
> <ui:decorate
>     template="/templates/OuterTemplate.xhtml"
>     xmlns:ui="http://java.sun.com/jsf/facelets";>
>     <ui:define name="content">
>         <ui:include src="InnerClient.xhtml" />
>     </ui:define>
> </ui:decorate>
> OuterTemplate.xhtml:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd";>
> <html
>     xmlns="http://www.w3.org/1999/xhtml";
>     xmlns:ui="http://java.sun.com/jsf/facelets";
>     xmlns:f="http://java.sun.com/jsf/core";
>     xmlns:h="http://java.sun.com/jsf/html";>
> <f:view>
>     <h:head>
>         <title>title</title>
>     </h:head>
>     <h:body>
>         <ui:insert name="content" />
>     </h:body>
> </f:view>
> </html>
> InnerClient.xhtml:
> <ui:composition
>     template="/templates/InnerTemplate.xhtml"
>     xmlns="http://www.w3.org/1999/xhtml";
>     xmlns:ui="http://java.sun.com/jsf/facelets";>
>     <ui:define name="content">
>         Do you see me?
>     </ui:define>
> </ui:composition>
> InnerTemplate.xhtml:
> <f:subview
>     xmlns:ui="http://java.sun.com/jsf/facelets";
>     xmlns:f="http://java.sun.com/jsf/core";>
>     <ui:insert name="content" />
> </f:subview>
> But if OutterClient.xhtml looks like:
> <ui:decorate
>     template="/templates/OuterTemplate.xhtml"
>     xmlns:ui="http://java.sun.com/jsf/facelets";>
>     <ui:define name="content">
>         <ui:composition template="/templates/InnerTemplate.xhtml">
>             <ui:define name="content">
>                 Do you see me?
>             </ui:define>
>         </ui:composition>
>     </ui:define>
> </ui:decorate>
> it outputs "Do you see me?" which is expected result in both cases. I think 
> first case should work too - or am I missing something?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to