且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JSF ResourceBundle中的EL变量

更新时间:2023-12-04 18:03:16

JSF resourcebundles在默认情况下不会解析EL.但是,默认情况下它支持 MessageFormat API <h:outputFormat> <f:param>

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

使用

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

您甚至可以明确地将其设置为number类型,例如根据视图区域设置,1000将显示为1,0001.000.

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

有关更多格式设置选项,请参见 MessageFormat API文档.

For more formatting options see thus the MessageFormat API documentation.