用servlet
public void service(ServletRequest request, ServletResponse response)
throws ServletException, IOException {
String time =(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date());
PrintWriter out = response.getWriter();
out.println("");
out.println("
前端是js的直接发个ajax请求,后台new Date()格式化下返回来就行了