直接使用System.out.println()
或者System.err.println() 就行
protectedvoid doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("现在的时间是:"+new Date());
response.setContentType("text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
String now = "现在的时间是:";
now += new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒E").format(new Date());
System.out.println(now);
out.println(now); //返回给客户端,println长的一样.
out.flush();
}