c3p0配置mysql
注意mysql依赖在c3p0-config.xml下
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version>
</dependency>
driver版本
5.0.x版本driver用com.mysql.jdbc.Driver
8.0.x版本driver用com.mysql.cj.jdbc.Driver
出现WARN
出现warn用serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
解决windows.close()各浏览器不兼容问题
if (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Chrome") != -1) {
window.location.href = "about:blank";
window.close();
} else {
window.opener = null;
window.open("", "_self");
window.close();
}
报错com/mysql/jdbc/Driver : Unsupported major.minor version 52.0
解决方案:
1、jdk7+老版5.0驱动com/mysql/jdbc/Driver
2、jdk8+新版6.0驱动com/mysql/cj/jdbc/Driver
jquery插件获取表单编辑信息转json
// 自定义的jquery函数
$.fn.extend({
serializeJson : function() {
var json = {}; // 就是一个javascript的对象.
// 1.通过jquery提供的serializeArray方法得到不符合要求的json串
var msg = this.serializeArray();
// console.info(msg);
// [Object { name="username", value="tom"}, Object { name="password",
// value="123"}, Object { name="hobby", value="eat"}, Object {
// name="hobby", value="drink"}, Object { name="hobby", value="play"}]
$(msg).each(function() {
if (json[this.name]) { // 在json对象中没有this.name对应的值
// 有,需要考虑一个名称对应多个值,而这些值应该放入到数组中
if (!json[this.name].push) { // 如果为true,代表是数组,如果为false,代表不是数组
json[this.name] = [ json[this.name] ];
}
json[this.name].push(this.value || ''); // 装入到数组
} else {
// 没有
json[this.name] = this.value || '';
}
});
return json
}
});