|
You didn't use formatting
The introduction of the java.util.Currency class, the currencyCode attribute priority of <fmt:formatNumber> **** exceeds
currencySymbol property. But for older versions of JDK, the currencySymbol attribute has priority.
maxIntegerDigits, minIntegerDigits, maxFractionDigits and
The minFractionDigits attribute is used to control the number of significant digits displayed before and after the decimal point. These attributes require integer values.
groupingUsed
The attribute has a boolean value and controls whether to group the numbers before the decimal point. For example, in the English language environment, divide every three digits of the larger number into a group, and each group is delimited by a comma. Other locales use periods or spaces to delimit such groups. The default value of this attribute is
true.
Listing 3 shows a simple currency example, which itself is an extension of Listing 1. In this case, don’t specify currencyCode or
currencySymbol property. The currency is determined by the locale setting.
Listing 3. Use the <fmt:formatNumber> tag to display currency values
<table>
<fmt:timeZone value="US/Eastern">
<c:forEach items="${entryList}" var="blogEntry"
varStatus="status">
<c:if test="${status.first}">
<tr><td align="left" class="blogDate">
<fmt:formatDate value=
"${blogEntry.created}" dateStyle="full"/>
</td></tr>
</c:if>
<tr><td align="left" class="blogTitle">
<c:out value="${blogEntry.title}" escapeXml="false"/>
</td></tr>
<tr><td align="left" class="blogText">
<c:out value="${blogEntry.text}" escapeXml="false"/>
<font class="blogPosted">
[My <fmt:formatNumber value="0.02" type="currency"/>
posted at <fmt:formatDate value="${blogEntry.created}"
pattern="h:mm a zz"/>]
</font>
</td></tr>
</c:forEach>
</fmt:timeZone>
</table> |
|