我用的是displaytag1.2,现在列表显示中数字格式有2个问题
1、0.72显示成.72,前面的0失踪。
2、大于7位的数字会用科学计数法显示,如:12345678,显示为:1.2345678E7。我现在的需求是要求不用科学计数法。用displaytag的format属性好像没有用。还望论坛的高手指点迷津...谢谢!
1、0.72显示成.72,前面的0失踪。
2、大于7位的数字会用科学计数法显示,如:12345678,显示为:1.2345678E7。我现在的需求是要求不用科学计数法。用displaytag的format属性好像没有用。还望论坛的高手指点迷津...谢谢!
解决方案 »
- 求高人指点,webEQApplet.jar怎么使用啊!
- 求一个能播放rmvb,rm格式文件的视频控件代码
- struts2怎么进行权限控制
- 如何获取在线用户?
- 20 分问:javascript 的简单问题 有关窗体的
- request和page的生存周期的区别?
- extJs控制button位置的问题
- 请问那里有整站源代码下载, 包括网站的大部分功能, 分不够另开贴给!
- $$$$$$$$$我用WEBLOGIC6.1+jbulider7,编译jsp+javaBean文件,为什么出现以下错误?
- 三层C/S结构需要开发专用的客户端还是只需使用浏览器
- [++急]如何禁止iframe内表单刷新再次提交???
- Hibernate中List集合的问题
format="{0,number,0.00}"2、大于7位的数字会用科学计数法显示,如:12345678,显示为:1.2345678E7。我现在的需求是要求不用科学计数法。
format="{0,number,#######0.00}"
You can use any valid java.text.MessageFormat pattern in the format attribute. Sorting will be based on the original object, not on the formatted String.
Note that errors due to an invalid pattern/object combination (for example trying to format a String like a number) will not be rethrown. Instead, an error log will be written and the original unformatted object displayed.You can also use a format pattern along with column decorators (the pattern will be applied after the decoration).这是官方文档的说明。我现在是将数据取出来通过一个全部是String类型的VO对象封装,到页面上format就无作用。有什么好办法解决?
String str = fmt.format(0.72);
System.out.println(str);fmt = new DecimalFormat("0");
str = fmt.format(12345678);
System.out.println(str);
/**
* @memo 作为ResultSet转向ArrayList公用类,
*/public class ResultRow {
// ---------------------------------------------------------
//该bean作RS对象行所用
// --------------------------------------------------------- Instance Variables
private String col1;
private String col2;
private String col3;
private String col4;
private String col5;
private String col6;
private String col7;
private String col8;
private String col9;
private String col10;
...getter/setter...对象封装成list返回到页面的displaytag中,
<display:column property="col1" title="总额" style="width:10%;text-align:left" format="{0,number,#######0.00}"/>
format失效,估计是要此字段是数字字段才行,我这个col1是String类型的,故失效。
我在哪里去NumberFormat呢?
a.zhangh col2,--VARCHAR2(20),排序正常
b.ClerkID col3,--VARCHAR2(10),排序正常
b.ClerkName col4,--VARCHAR2(50),排序正常
trunc(b.scale) col5,--varchar2(20),排序异常
to_number(a.youhll) col6,--NUMBER(9,7),排序正常
a.kaihrq col7,--VARCHAR2(8),排序正常
round(sum(a.zhhuye)/31,2) col8--NUMBER(15,2),排序异常
FROM table1 a, table2 b
where a.zhangh = b.Account
and a.data_his >='20090501'
and a.data_his <='20090525'
and substr(a.zhangh, 7, 2) = '53'
and b.BusiType = '存款类'
group by a.kehzwm,
a.zhangh,
b.ClerkID,
b.ClerkName,
b.scale,
a.youhll,
a.kaihrq
having sum(a.zhhuye) / 31 > 0
order by col8 desc这是我的原始sql,col5,col8两个为什么不能正常排序?有个现象是第一次默认取数据出来是正常排序的,但点击列表头的排序按钮,就排序异常。
加上foramt、decorator属性也没用,还请高手看看。