[ https://issues.apache.org/jira/browse/MYFACES-3665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Leonardo Uribe resolved MYFACES-3665. ------------------------------------- Resolution: Fixed Fix Version/s: 2.1.11 2.0.17 > f:metadata section removed when refresh view and is not included in the > template directly > ----------------------------------------------------------------------------------------- > > Key: MYFACES-3665 > URL: https://issues.apache.org/jira/browse/MYFACES-3665 > Project: MyFaces Core > Issue Type: Bug > Components: JSR-314 > Reporter: Leonardo Uribe > Assignee: Leonardo Uribe > Fix For: 2.0.17, 2.1.11 > > > Suppose this example: > ex1.xhtml > <ui:composition template="/META-INF/templates/template1.xhtml"> > <f:metadata> > <f:viewParam name="id"/> > </f:metadata> > <ui:define name="container"> > <h1>Myfaces Examples</h1> > <h:messages/> > <h:form id="mainForm"> > <h:commandButton value="POSTBACK"/> > </h:form> > </ui:define> > </ui:composition> > 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:metadata> > <f:viewParam name="id"/> > </f:metadata> > <!-- ..... --> > </ui:define> > 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: > <ui:composition > xmlns="http://www.w3.org/1999/xhtml" > xmlns:ui="http://java.sun.com/jsf/facelets" > xmlns:h="http://java.sun.com/jsf/html" > xmlns:f="http://java.sun.com/jsf/core"> > <f:metadata> > <f:viewParam name="id"/> > </f:metadata> > <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: http://www.atlassian.com/software/jira