USERLANGUAGE和JSESSIONID Cookie是否隐含?

时间:2014-03-02 11:53:29

标签: java servlets cookies httpsession

关于主题:USERLANGUAGE和JSESSIONID cookie是隐式的HttpServletRequest的一部分吗?即使没有声明任何httpsession?

protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

         //   HttpSession session = req.getSession(true);
            Cookie[] cookies = req.getCookies();
            ServletOutputStream out = resp.getOutputStream();
            out.println("<html>");
            out.println("<head>");
            out.println("</head>");
            out.println("<body>");
            for (Cookie cookie : cookies) {
                 out.println(cookie.getName()+": "+ cookie.getValue());
            }
            out.println("</body>");
            out.println("</html>");
}

在上面的代码报告中,即使我没有声明任何httpSession,我将 USERLANGUAGE JSESSIONID 作为Cookies数组的一部分。我不应该改为null吗?

0 个答案:

没有答案