struts1.x中bean:write标签格式化输出
来源:互联网 发布:项目管理平台 java 编辑:程序博客网 时间:2024/05/01 11:41
)时间:
request.setAttribute("time", new Date());
使用<bean:write name="time" scope="request"/>进行输出,其输出结果将是:
Sun Dec 14 15:38:51 CST 2008
如果希望输出这种格式2008-12-14 15:41:12
<bean:write name="time" scope="request" format="yyyy-MM-dd HH:mm:ss"/>
如果希望输出这种格式,2008年12月14日 15点41分12秒 <bean:write
name="testVo" property="date" format="yyyy年MM月dd日 HH点mm分ss秒"/>
(2)数字:
request.setAttribute("n", 3.14159265358979323846)
直接使用<bean:write name="n" scope="request"/>进行输出,其输出结果将是:
原封不动的3.14159265358979323846
保留4位:
<bean:write name="n" scope="request" format="#.####" />
如果放进去的是3.14,输出却要小数点后保留4位,不足4位用0补上
<bean:write name="n" scope="request" format="0.0000" />或者<bean:write
name="n" scope="request" format="#.0000" />
如果要输出003.1400
<bean:write name="n" scope="request" format="000.0000" />
如果这样写<bean:write name="n" scope="request" format="###.0000" />,
则输出的是:3.1400,并不会在前面补0
以下写法均为错误写法:
<bean:write name="n" scope="request" format="##0.0000" />
<bean:write name="n" scope="request" format="000.##00" />
注意:这里的“#”与“0”并不通用,“#”只能在小数点前面,并且不能与“0”
一起出现在小数点前面
0可以出现在小数点前面和后面,但不能与"#"一起出现在小数点前面或后面。
- struts1.x中bean:write标签格式化输出
- struts1.x中bean:write标签格式化输出
- Struts1.x中 bean:write format 属性格式化输出日期,数字
- struts1.x bean:write 标签的使用
- struts1.x bean:write 标签的使用
- 使用struts中bean:write标签格式化输出
- Struts bean:write 标签格式化输出
- Struts 的标签库 Struts bean write 输出 格式化 标签
- struts1 logic:iterate bean:write标签使用
- struts1 logic:iterate bean:write标签使用
- struts1的bean:write标签输出int和bigdecimal类型数据异常
- Struts1的bean:write标签无法输出int、float等数据类型的解决情况
- struts1.x中bean:write 中的format和formatkey,bundle 的用法
- struts1.x-bean标签库实例
- Struts中如何对bean:write输出的数据进行格式化
- bean:write之四输出的数据进行格式化
- struts中bean:write标签问题
- bean:write 格式化
- Java Thread 用法实例
- 游标使用
- .NET下实现分布式缓存系统Memcached
- 用style设置div的高度和宽度
- 解决无SD卡拍照问题
- struts1.x中bean:write标签格式化输出
- dtd
- ibatis3整合spring
- template functor
- 在Android下创建文件夹
- C++ 关键字
- android VideoView的使用例程
- 水晶报表分组
- 创建JSP2.0标记文件