Outside of ui:define "body" is actually the original state of the JSF 1.2
template -- I had moved it around while trying to debug the problem, and
forgot to move it back when writing up this email.


Are you saying that if I have ui:param outside of ui:define "body", it
should work for files included in ui:define "body"?



=========== What somepage.xhtml really looked like under JSF 1.2
=================
<ui:decorate template="/pages/include/
template.xhtml"
...>

        <ui:param name="sourcePage" value="#{sourcePageBeanExpression}" />

       <ui:define name="body">
===========  somepage.xhtml =================


On Thu, Dec 15, 2011 at 10:59 AM, Leonardo Uribe <lu4...@gmail.com> wrote:

> Hi
>
> The javadoc of ui:param says this:
>
> "...Use this tag to pass parameters to an included file (using
> ui:include), or a template (linked to either a composition or
> decorator). Embed ui:param tags in either ui:include, ui:composition,
> or ui:decorate to pass the parameters. ..."
>
> In myfaces this was explained in [1] . Before that change ui:param
> just added a param to the current variable resolver, just like c:set
> does, but note that is not what the spec says. Use ui:param inside
> ui:decorate but not inside ui:define.
>
> regards,
>
> Leonardo Uribe
>
> [1]
> http://mail-archives.apache.org/mod_mbox/myfaces-dev/201106.mbox/%3CBANLkTi=h52lhhuxk_mo8qojhexsndh9...@mail.gmail.com%3E
>
> 2011/12/15 Mike Kienenberger <mkien...@gmail.com>:
> > Under JSF 1.2 and Facelets, you could specify a ui:param value as a child
> > of ui:decorate, and it would be used in any included files.
> > Under JSF 2.1, the ui:param value evaluates to null in the included files
> > unless it is passed as a child of the ui:include.
> >
> > Is this a bug or a spec-required change in behavior?
> >
> > ===========  template.xhtml =================
> > <html>
> > ...
> >     <ui:insert name="body" />
> > ...
> > </html>
> > ===========  template.xhtml =================
> >
> >
> > ===========  somepage.xhtml =================
> > <ui:decorate template="/pages/include/template.xhtml"
> > ...>
> >
> >  <ui:define name="body">
> >        <ui:param name="sourcePage" value="#{sourcePageBeanExpression}" />
> >
> >          // This included page would have a null sourcePage  (worked
> under
> > JSF1.2/Facelets)
> >         <ui:include src="includedFragment.xhtml">
> >         </ui:include>
> >
> >          // This included page would have a valid sourcePage
> >         <ui:include src="includedFragment.xhtml">
> >               <ui:param name="sourcePage"
> > value="#{sourcePageBeanExpression}" />
> >         </ui:include>
> >
> >  </ui:define>
> > <ui:decorate>
> > ===========  somepage.xhtml =================
> >
> >
> > ===========  includedFragment.xhtml =================
> > <ui:composition xmlns="http://www.w3.org/1999/xhtml";
> > ...>
> >
> >  <ui:param name="myBean"
> > value="#{sourcePage.specificIncludedBeanBehavior}"/>
> >
> >    <h:outputText value="#{myBean.valueString}" />
> >    <h:panelGrid binding="#{myBean.messagePanel}" />
> >    etc
> >
> > </ui:composition>
> > ===========  includedFragment.xhtml =================
>

Reply via email to