myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <>
Subject [jira] [Created] (MYFACES-3665) f:metadata section removed when refresh view and is not included in the template directly
Date Mon, 17 Dec 2012 22:18:12 GMT
Leonardo Uribe created MYFACES-3665:

             Summary: f:metadata section removed when refresh view and is not included in
the template directly
                 Key: MYFACES-3665
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-314
            Reporter: Leonardo Uribe
            Assignee: Leonardo Uribe

Suppose this example:


<ui:composition template="/META-INF/templates/template1.xhtml">
    <f:viewParam name="id"/>
  <ui:define name="container">
    <h1>Myfaces Examples</h1>
    <h:form id="mainForm">
        <h:commandButton value="POSTBACK"/>

The template page (template1.xhtml) includes the content under "container" section but note
f:metadata is outside that part so it is not included. 

The compilation suppose 2 steps:

- Build a view metadata facelet, which only has what's inside <f:metadata> section,
no matter where is it.
- Build a normal facelet, which builds the component tree itself.

In this case, when the normal facelet is applied, the section under f:metadata is removed
by facelets refresh algorithm, because it is not included in that facelet. It is an effect
that is difficult to see, but it appear when you have a preRenderView listener or in the tests
using JSF 2.2 f:viewAction.

The spec javadoc suggest do this instead:

<ui:composition template="/META-INF/templates/template1.xhtml">
  <ui:define name="metadata">
        <f:viewParam name="id"/>
    <!-- ..... -->

And add in the template on the top level a simple <ui:insert name="metadata/> to include
the section when facelets process the page.

Other alternative is use this syntax:

        <f:viewParam name="id"/>
<ui:decorate template="template1.xhtml">

It also works but the point is f:metadata is never inside a <c:if> section or any other
that changes the tree structure dynamically, because the compilation suppose only it should
be located at the top page level and not in a template client.

So, the first syntax should be valid, and its more, even put f:metadata outside ui:composition
should work, because the syntax is smaller.

The proposed fix is exclude f:metadata facet from mark/delete algorithm, just adding some
lines in DefaultFacelet.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message