java格式化金额

格式化金额巧用0.00

DecimalFormat df = new DecimalFormat("#,##0.00"); 
        this.print(df.format(money));
 
@Setter
@Getter
public class MoneyFormatTaglib extends BodyTagSupport {
	private double money;
	
	public int doEndTag() throws JspException {
        DecimalFormat df = new DecimalFormat("#,###0.00"); 
        this.print(df.format(money));
	return this.EVAL_BODY_INCLUDE;
	}
	
	public int doStartTag() throws JspException {
		return this.EVAL_PAGE;
	}
	
}

猜你喜欢

转载自anhongyang125.iteye.com/blog/2343079
今日推荐