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/%[email protected]%3E

2011/12/15 Mike Kienenberger <[email protected]>:
> 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