jsp中的格式编号 [英] Format number in jsp

查看:56
本文介绍了jsp中的格式编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将123456789的int值格式设置为123,456,789?

How do I format an int value of 123456789 as 123,456,789?

推荐答案

尝试此代码

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));
}

}

您可以在jsp块<%中编写一个函数! %>和main方法中的代码.

you can write a function in jsp block <%! %> and the code inside the main method.

这篇关于jsp中的格式编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆