如果需要按照用户当前的 locale 格式化或者解析 BigDecimal
、 Integer
、 Long
、 Double
、 Boolean
或者 Date
类型,可以使用 DatatypeFormatter
bean,示例:
link:../../../../../../source/common/dateformat_4.java[role=include]
下面是直接使用 Datatype
的例子。
-
日期格式化示例:
link:../../../../../../source/common/dateformat_2.java[role=include]
-
在 Web 客户端格式化数字,显示最多 5 位小数示例:
com/sample/sales/web/messages_ru.propertiescoordinateFormat = #,##0.00000
link:../../../../../../source/common/dateformat_3.java[role=include]