给定一个带键的属性文件
property.code=Text goes here {0}
并且
discountPercentage = 5.0
当我这样做时
<fmt:formatNumber value="${discountPercentage / 100}" var="discount"
type="PERCENT" minFractionDigits="1" maxFractionDigits="1" />
<spring:message code="property.code" arguments="${discount}" />
然后弹簧消息标签剥离小数位和%符号,只显示5而不是5.0%
无法弄清楚这里发生了什么......我认为它会起作用。
答案 0 :(得分:2)
我的猜测是,您的本地制作的格式为5,0%
,而不是5.0%
。 Spring消息标记的arguments
属性需要以逗号分隔的参数列表。
尝试根本不传递分隔符或伪分隔符:
<spring:message code="property.code" arguments="${discount}" argumentSeparator="${null}" />
或
<spring:message code="property.code" arguments="${discount}" argumentSeparator="" />
或
<spring:message code="property.code" arguments="${discount}" argumentSeparator="fake" />