bboss标签库cell标签格式化数字实例

简介: bboss标签库cell标签格式化数字实例 带double类型的po对象定义: package test; public class TestBean { private String id; private String name; private TestBean i...
bboss标签库cell标签格式化数字实例

带double类型的po对象定义:
package test;

public class TestBean {
	private String id;
	private String name;
	private TestBean inner;
	private long sellMonery = 1000l;
	private double selldoubleMonery = 100000.00d;
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public TestBean getInner() {
		return inner;
	}
	public void setInner(TestBean inner) {
		this.inner = inner;
	}
	public long getSellMonery() {
		return sellMonery;
	}
	public void setSellMonery(long sellMonery) {
		this.sellMonery = sellMonery;
	}
	public double getSelldoubleMonery() {
		return selldoubleMonery;
	}
	public void setSelldoubleMonery(double selldoubleMonery) {
		this.selldoubleMonery = selldoubleMonery;
	}

}


初始化一个TestBean对象并设置到request中:
//构建TestBean对象
	TestBean bean = new TestBean();
	bean.setId("uuid");
	bean.setName("多多");
	bean.setSellMonery(10000000);
	bean.setSelldoubleMonery(10000000.334d);//只有double类型的数字小数位,###,###.##才能正确输出后面的小数
	TestBean ibean = new TestBean();
	ibean.setId("uuidinner");
	ibean.setName("多多uuidinner");
	ibean.setSellMonery(10000000);
	bean.setInner(ibean);
	request.setAttribute("testbean",bean);


通过cell标签输出各个属性,并且利用numformat属性格式化SellMonery和selldoubleMonery两个属性:
<pg:beaninfo actual="${testbean }">
		<tr class="cms_data_tr">
				<td>
					testbean:
				</td> 
				<td>
					selldoubleMonery:<pg:cell colName="selldoubleMonery" numerformat="###,###.###"/>
				</td>
				<td>
					sellMonery:<pg:cell colName="sellMonery" numerformat="###,##"/>
				</td>
				<td>
					id:<pg:cell colName="id" />
				</td> 
				<td>
					name:<pg:cell colName="name" />
				</td> 
				<td>
					innerid:<pg:cell colName="inner" property="id" />
				</td> 
				<td>
					innername:<pg:cell colName="inner"  property="name" />
				</td> 
			</tr>
			</pg:beaninfo>



目录
相关文章
|
XML 数据格式
Freemarker填充数据到word模板中
Freemarker填充数据到word模板中
122 1
|
XML Java 数据格式
J2EE&JSP自定义标签库01&out标签&if标签
J2EE&JSP自定义标签库01&out标签&if标签
|
区块链
JSTL格式化标签
JSTL格式化标签
65 0
|
XML SQL Java
JSTL 标签库,以及 out 和 set 标签|学习笔记
快速学习 JSTL 标签库,以及 out 和 set 标签
146 0
JSTL 标签库,以及 out 和 set 标签|学习笔记
|
XML 数据格式 开发者
XML元素的定义(标签定义)|学习笔记
XML元素的定义(标签定义)
|
关系型数据库
bboss标签库cell标签展示嵌套对象属性方法实例
bboss标签库cell标签展示嵌套对象属性方法实例 带嵌套对象PO类定义 package test; public class TestBean { private String id; private String name; private TestBean inn...
800 0