myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <>
Subject [jira] Commented: (MYFACES-2753) Trivial multi-level templating does not work if ui:include is used
Date Fri, 23 Jul 2010 00:26:51 GMT


Leonardo Uribe commented on MYFACES-2753:

Attached to this issue there is a patch (MYFACES-2753-TestCase-FixInclude.patch) that has
two things:

1. Some test cases that probe different situations of ui:composition and ui:decorate tags.
2. The fix to make the example provided at start works.

I'm still not finished all test required to do. The situation on mojarra issue 1684 and added
as a test:


<ui:composition template="/composition4.xhtml">
<ui:define name="fragment1">


<ui:composition template="/template1.xhtml">
<ui:define name="fragment1">


This fragment will not be inserted
<ui:insert name="fragment1">

The current response is the ui:composition in compositionNested1.xhtml takes precedence, but
it is the expected behavior. In fact, the previous example can be rewritten using ui:decorate
and obtain the required effect. Just rewrite composition4.xhtml with this:

<ui:decorate template="/template1.xhtml">
<ui:define name="fragment1">

According to the tests done, ui:composition and ui:decorate are different. ui:composition
cannot be nested on the same page and the intention is its definitions takes precedence over
the template referenced ones. ui:decorate could be used multiple times on the same page and
it is expected the most recent processed takes precedence. I tried some tests doing combinations
of ui:decorate and ui:composition and the current algorithm works.

Thinking more about it, really the problem is that the original facelets code does not have
the concept we introduce on myfaces about a template context. 

To make the first example work I tried to isolate the context between ui:include with success.
Definitively this is the expected behavior. At this time I'm not have (and I can't imagine)
any example that shows the opposite. To make template compositions, the way is always use
ui:composition and ui:decorate tags. The meaning of use ui:include is take everything from
one page and put it in the location of this tag.

I'll do more examples and check how user tags (facelet tags created from xhtml) are handled.
I think maybe we could require the same hack we did for ui:include, but I want to create some
tests before change the code just to be sure everything is all right.

> Trivial multi-level templating does not work if ui:include is used
> ------------------------------------------------------------------
>                 Key: MYFACES-2753
>                 URL:
>             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-TestCase-FixInclude.patch, 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="">
>     <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"
> "">
> <html
>     xmlns=""
>     xmlns:ui=""
>     xmlns:f=""
>     xmlns:h="">
> <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=""
>     xmlns:ui="">
>     <ui:define name="content">
>         Do you see me?
>     </ui:define>
> </ui:composition>
> InnerTemplate.xhtml:
> <f:subview
>     xmlns:ui=""
>     xmlns:f="">
>     <ui:insert name="content" />
> </f:subview>
> But if OutterClient.xhtml looks like:
> <ui:decorate
>     template="/templates/OuterTemplate.xhtml"
>     xmlns:ui="">
>     <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.

View raw message