【注】仅供个人记录使用
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(df.format(new Date()));// new Date()为获取当前系统时间//前端用jQuery发起ajax请求
$.post("url",{参数1:值1,参数2:值2},function(data,status){ //回调函数 });
//后台处理请求,返回结果
response.setContentType("text/html;charset=utf-8");
PrintWriter out;
try {
out = response.getWriter();
out.print(responseText);
out.flush();
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("写入ResponseText出错");
}
}
//用json封装json
JSONArray jsonArray = JSONArray.fromObject( list);
需要包
-----jakarta commons-lang 2.5
-----jakarta commons-beanutils 1.8.0
-----jakarta commons-collections 3.2.1
-----jakarta commons-logging 1.1.1
-----ezmorph 1.0.6