Dav*_*e G 15
使用JSTL fmt:formatNumber
将您的模式设置为#,## 0
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:formatNumber pattern="#,##0" value="${value}" />
Run Code Online (Sandbox Code Playgroud)
这将要求您在WEB-INF/lib文件夹中具有JSTL标准标记库
http://tomcat.apache.org/taglibs/standard/
现在我不是100%肯定,但大多数现代容器提供"核心"API库jstl.jar,您的Web应用程序必须提供实现.在上述链接的情况下,下载中应包含standard.jar.
试试这个代码
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
DecimalFormat formatter = new DecimalFormat("###,###,###");
System.out.print(formatter.format(123456789));
}
Run Code Online (Sandbox Code Playgroud)
}
你可以在jsp块中编写一个函数 <%! %> 以及 main 方法内的代码。
归档时间: |
|
查看次数: |
25583 次 |
最近记录: |