myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rudy De Busscher <>
Subject View parameter <f:viewParam> is not working in combination with templating like <ui:composition>
Date Thu, 12 Jan 2012 13:28:38 GMT
Hi All,

I have an issue with the view parameters in combination with templating.

in file *templates/template.xhtml
*<html xmlns="" xmlns:h=""

    <f:viewParam name="parameterValue" value="#{helloBean.test}"
id="paramTemplate" />


in file *test.xhtml

**<html xmlns="" xmlns:h=""

<ui:composition template="/templates/template.xhtml">

    <ui:define name="title">ViewParameter issue</ui:define>

    <ui:define name="content">
            Parameter value #{param.parameterValue} <br/>
            Backing bean property #{helloBean.test} <br/>
When I call the page with the URL test.jsf?parameterValue=Rudy, only the
first line is correct, the el #{helloBean.test} returns null.

Without templating, the correct behaviour is shown.

I was able to trace it back to the class
which only takes into account the <f:metadata> tags in the file. (called
from the RestoreViewExecutor when the view meta data is generated in case
of a non-postback (viewRoot = metadata.createMetadataView(facesContext);  )
This handler ignores the <ui:composition> and thus missing the definition
in the template.

You can work around it by specifying the <f:metadata> within a <ui:define>
and put it in the template at the correct place (so that the parent of
<f:metadata> is the ViewRoot)

I have the use case that I have a lot of pages where a viewParameter should
be present and I don't like to repeat it on every view (in case things

Is this issue to specific for my situation or should I create a Jira Issue
for it?


Rudy De Busscher

View raw message