Search code examples
jsfparametersmessage

Why isn't my f:param rendering inside h:outputText?


I have a message.properties file which contains:

success_text=How cool... You have guessed the number.  {0} is correct! 

I have a JSF which contains:

<h:outputText value="#{msg.success_text}" >
    <f:param value="#{numberBean.userNumber}" />
</h:outputText>

No matter what the value of is, the HTML comes out:

How cool... You have guessed the number. {0} is correct!

Why isn't {0} changing to the value indicated in the <f:param> and how can I fix it?


Solution

  • The <f:param> isn't supported by <h:outputText>. It works in <h:outputFormat> only.

    <h:outputFormat value="#{msg.success_text}" >
        <f:param value="#{numberBean.userNumber}" />
    </h:outputFormat>