如何在JSP中格式化百分比?
<FMT:formatNumber>标记用于格式数字,百分比,和货币。
属性
<FMT:formatNumber>标签具有以下属性-
示例
<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix = "fmt" uri = "http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<title>JSTL fmt:formatNumber Tag</title>
</head>
<body>
<h3>Number Format:</h3>
<c:set var = "balance" value = "120000.2309" />
<p>Formatted Number (1): <fmt:formatNumber type = "percent" maxIntegerDigits="3" value = "${balance}" /></p>
<p>Formatted Number (2): <fmt:formatNumber type = "percent" minFractionDigits = "10" value = "${balance}" /></p>
<p>Formatted Number (3): <fmt:formatNumber type = "percent" maxIntegerDigits = "3" value = "${balance}" /></p>
</body>
</html>上面的代码将产生以下结果-
Number Format: Formatted Number (1): 023% Formatted Number (2): 12,000,023.0900000000% Formatted Number (3): 023%
热门推荐
1 带狗狗训练
4 听力训练狗狗
6 怎训练狗狗
7 腹肌训练狗狗
8 网球训练狗狗
9 记叙文训练狗狗
10 狗狗太凶怎么训练
11 核心力量训练狗狗
12 狗狗乱叫怎么训练
13 发音训练狗狗
14 怎么训练狗狗叼东西给主人
15 荆州训练狗狗
16 篮球训练狗狗
17 做训练狗狗
18 训练狗狗坐姿