Java 当作为参数传递给spring消息标记时,格式化值将丢失其格式
给定一个具有密钥的属性文件Java 当作为参数传递给spring消息标记时,格式化值将丢失其格式,java,spring-mvc,localization,jstl,Java,Spring Mvc,Localization,Jstl,给定一个具有密钥的属性文件 property.code=Text goes here {0} 及 当我这样做的时候 <fmt:formatNumber value="${discountPercentage / 100}" var="discount" type="PERCENT" minFractionDigits="1" maxFractionDigits="1" /> <spring:message code="property.c
property.code=Text goes here {0}
及
当我这样做的时候
<fmt:formatNumber value="${discountPercentage / 100}" var="discount"
type="PERCENT" minFractionDigits="1" maxFractionDigits="1" />
<spring:message code="property.code" arguments="${discount}" />
然后spring messge标记去掉分数数字和%符号,只显示5,而不是5.0%
搞不懂这里发生了什么。。我原以为它会起作用。我猜您的本地计算机生成格式化值
5,0%
,而不是5.0%
。spring消息标记的arguments
属性需要一个逗号分隔的参数列表
尝试不传递任何分隔符,或传递假分隔符:
<spring:message code="property.code" arguments="${discount}" argumentSeparator="${null}" />
或
或
<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" />