Use the <FMT> label
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
Its URI can be in the FMT. TLD File
1. Date formatting
<fmt:formatDate value=“${XXX.date}” pattern=“yyyy-MM-dd HH:mm:ss”/>
Value: the date to be formatted.
Pattern: Format of the date format
<FMT: formatnumber value = "12" type = "currency" pattern = "$. 00"/> -- $12.00
<FMT: formatnumber value = "12" type = "currency" pattern = "$. 0 #"/> -- $12.0
<FMT: formatnumber value = "1234567890" type = "currency"/> -- $1,234,567,890.00 (the currency symbol is related to the local setting of the current Web Server)
<FMT: formatnumber value = "123456.7891" pattern = "#, #00.0 #"/> -- 123,456.79
<FMT: formatnumber value = "123456.7" pattern = "#, #00.0 #"/> -- 123,456.7
<FMT: formatnumber value = "123456.7" pattern = "#, #00.00 #"/> -- 123,456.70
<FMT: formatnumber value = "12" type = "percent"/> -- 1,200% (type can be currency, number, and percent)
Java formatted output:
Decimalformat df = new decimalformat ("format ");
String FMt = DF. Format (double );
Symbolic Meaning
0: one digit
# One digit, leading zero and ending zero are not displayed
. Decimal place
, Group separator location
-Negative number prefix
% Multiply by 100 and display the percentage sign
Other symbols include the specified symbols in the output string.