但是不能存放在json里面,如果存放在json里面会报错
解决方案 »
- ztree中获取数据问题($.post中能给参数赋值吗) 急
- frameset里面的frame被加载了两次
- 请问控制同一台机器只能投票一次有什么好的解决方案吗
- servlet拦截了所有请求后的js和图片处理问题
- 在websphere下引用log4j, 并为某一应用制定log路径,该如何做??
- 进行了安全设置的access数据库文件.mdb(创建了*.mdw),如何用jdbc连接?
- 帮忙看看这段代码哪里出的问题
- jquery取值
- jsp页面得到的值如何传给<% %> 代码片段
- 跟大家讨论一个spring hibernate事务管理的问题
- javaBean为什么是客户端应用程序?
- jstl标签无法识别
在前台就去这个get方法的值
例如字段是date 有一个getDate的方法,再写一个getDateStr
前台就直接去dateStr就好了!
Date.prototype.Format = function (fmt) { //author: meizz
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"h+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}//根据tpi_birth的time值实例一个date对象
var d = new Date(parseInt(tpi_birth.time));
//将日期格式化,d_str就是你想要的值
var d_str = new Date().Format("yyyy-MM-dd");
JsonConfig config = new JsonConfig();
config.setIgnoreDefaultExcludes(false);
config.registerJsonValueProcessor(java.sql.Date.class, new DateJsonValueProcessor("yyyy-MM-dd"));
JSONArray resultArray = JSONArray.fromObject(list,config);
这样设置再转换,sql.Date的日期类型就变成你要的字符串了。
详细点
cast(A.SupportDate as datetime) As SupportDate
rs.getTimestamp("SupportDate")
---Format
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
sdf.format(SupportDate)
OK了,因为我把它转成了java.util.date了,config.registerJsonValueProcessor(java.util.Date.class, new DateJsonValueProcessor("yyyy-MM-dd"));
$(#tb_1).datagrid('loaddata', json)
是这样的吗?