日期:2014-05-17 浏览次数:20774 次
servlet:server.time.get public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException { try{ String now = new StimeDateFormat("yyyy-MM-dd HH:mm:SS.sss").format(new Date()); PrintWriter out = response.getWriter(); response.setContentType("text/html;charset=GBK"); out.print("{server_time:'" + now + "'}"; out.flush(); out.close(); } catch(Exception ex){ ex.printStackTrace(); //不建议打印对战 //log.error("An error has occured when getting the time of server.", ex); }