Hi This is a long story already discussed inside MyFaces community. First of all the issues related to ui:include change are:
MYFACES-2753 Trivial multi-level templating does not work if ui:include is used Previously this issue has been reported in: MYFACES-2931 Regression: Template areas get lost when using <ui:include> MYFACES-2925 Facelets: Fail to insert from page included in template In the current implementation ui:include do what most people expect: "include" everything inside the page pointed by "src" attribute. The spec javadoc says. "... Use this tag—which is very similar to JSP's jsp:include—to encapsulate and reuse content among multiple XHTML pages. ...." This defines a new template context, so ui:define or ui:insert created outside ui:include should not be taken into account because it breaks encapsulation and reuse principles. If you want to include some content and use it into the current template context, just replace <ui:include src="..."/> with <ui:decorate template="..."/>. It makes exactly the same but it works in both Mojarra and MyFaces. The problem with c:set does not match the spec, so it does not work as expected. See: MYFACES-3169 ui:param and c:set implementations does not work as expected The spec javadoc says this: "... If "scope" the is present, but has a zero length or is equal to the string "page" ..." The original c:set in jsp works as a "page" scope. Obviously this tag was taken from there. But it is clear the original intention was not included and it should be, so in MyFaces this was corrected, so c:set now works with a internal page scope and ui:param as a param inside the template context. If you still need the backward behavior it is quite simple to create a custom tag that uses the VariableResolver. regards, Leonardo Uribe 2011/11/21 Hensel Michael <michael.hen...@cursor.de>: > Hello, > > we have a question regarding the visibility of <ui:define> across included > sites. > > Our website has been initially build to run on Mojarra, but we wanted to try > and switch to MyFaces due to different bugs in Mojarra 2.1.3. > > We use a templating which makes use of <ui:include> and a custom tag library. > I created a small example of how these includes look like. > > index.xhtml : > ############### > <ui:composition … > template="/WEB-INF/includes/template.xhtml"> > > <ui:define name="testDefine"> > <h:outputText value="Output from testDefine" /> > </ui:define> > > <ui:define name="main"> > <h:outputText value="Welcome to the HOME page." > /> > > <cu:test /> > > </ui:define> > > </ui:composition> > ############### > > Definition of <cu:test>: > ############### > <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"> > <ui:insert name=" testDefine ">testDefine not > found!</ui:insert> > </ui:composition> > ############### > > The problem we are running into is, that the insert from our custom tag > cannot find the <ui:define> defined in the parent page of the included tag. > This used to work on Mojarra. > It seems that, on MyFaces, the visibility of <ui:define> is restricted to the > current page. We are having the same problem with the <c:set> tag. > > Our question is, who is right in this case, Mojarra or MyFaces? As far as we > see, the JSF specification doesn’t provide any information on this. > > > Best regards, > Michael Hensel >