if ((cookies == null) || (cookies.length == 0)) { out.println("没有 cookies "); } else { out.println("<center><h1>响应消息中的Cookies 信息 </h1>"); // Display a table with all of the info out.println("<table border>"); out.println("<tr><th>Name</th><th>Value</th>" + "<th>Comment</th><th>Max Age</th></tr>"); for (int i = 0; i < cookies.length; i++) { Cookie c = cookies[i]; out.println("<tr><td>" + c.getName() + "</td><td>" + c.getValue() + "</td><td>" + c.getComment() + "</td><td>" + c.getMaxAge() + "</td></tr>"); } out.println("</table></center>"); } // Wrap up out.println("</body>"); out.println("</html>"); out.flush(); }
/** * <p>Initialize the servlet. This is called once when the * servlet is loaded. It is guaranteed to complete before any * requests are made to the servlet * @param cfg Servlet configuration information */
public void init(ServletConfig cfg) throws ServletException { super.init(cfg); }
/** * <p>Destroy the servlet. This is called once when the servlet * is unloaded. */