大家好,
我现在是在学习struts2的内容。
可是在编写转换器的时候,为什么——时间转换的时候,时:分:秒,不能够转换呢,
输出的时候,只有年月日,,而时间输出的是00:00:00 这是为什么呢,,
求高人指点.....我转换器的类是这样编写的:
public Object convertValue(Object object, Class totype) {
// TODO Auto-generated method stub
if(totype==Date.class){
String [] obStrings = (String[]) object;
SimpleDateFormat formatter=new SimpleDateFormat("yyyy-MM-dd hh:mm:ms");
Date result = null;
try {
result = formatter.parse(obStrings[0]);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
return null;
}
我现在是在学习struts2的内容。
可是在编写转换器的时候,为什么——时间转换的时候,时:分:秒,不能够转换呢,
输出的时候,只有年月日,,而时间输出的是00:00:00 这是为什么呢,,
求高人指点.....我转换器的类是这样编写的:
public Object convertValue(Object object, Class totype) {
// TODO Auto-generated method stub
if(totype==Date.class){
String [] obStrings = (String[]) object;
SimpleDateFormat formatter=new SimpleDateFormat("yyyy-MM-dd hh:mm:ms");
Date result = null;
try {
result = formatter.parse(obStrings[0]);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
return null;
}
解决方案 »
- 急急急!(送老婆了)十万火急...急急急!十万火急...急急急!十万火急...急急急!十万火急...急急急!十万火急...急急急!十万火急...
- eclipse中如何导入petstore
- 求 代码生成工具,500分相送!在此先贴100,望各位帮忙!
- hibernate sql错误 Cannot add or update a child row
- 对DAO的一些认识,望大家指正
- 在线求救:tag报一下错误!!!高分(200)
- bmp?
- 急,我在Internet 访问服务器的时候,需要服务器去访问内部局域网的站点,取的页面后在将这个页面进行分析,在转送给客户端,这个怎么实
- 懂EJB的高人救救我!
- 请问怎么遍历里面children的值
- 高分求解--浏览器的前进后退问题?(通用应用系统页面框架)
- hibernate 级联删除
你 System.out.println(obStrings[0]);看下结果
顺便说一声
楼主格式错了 yyyy-MM-dd HH:mm:ss
hh是12个小时制 HH是24小时制