EL variable in JSF ResourceBundle

前端 未结 1 1621
星月不相逢
星月不相逢 2020-12-19 10:01

i read somewhere (don\'t find it anymore) that i can use EL Expresions in the resource bundle and then use it without changes in *.xhtml files.

some.text=#{         


        
相关标签:
1条回答
  • 2020-12-19 10:47

    JSF resourcebundles does by default not resolve EL. It however by default supports MessageFormat API in combination with <h:outputFormat> and <f:param>.

    some.text = {0} more
    

    with

    <h:outputFormat value="#{i18n['some.text']}">
        <f:param value="#{someBean.stepsLeft}" />
    </h:outputFormat>
    

    You can even explicitly make it a number type so that e.g. 1000 will be displayed as 1,000 or 1.000 depending on the view locale.

    some.text = {0,number} more
    

    For more formatting options see thus the MessageFormat API documentation.

    0 讨论(0)
提交回复
热议问题