问题描述
截图在附件中sessiontest页面在火狐下可以取到seesionid,但在ie下却变成了下载,是什么原因?(servlet页面)代码如下:protected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {HttpSession hs = req.getSession();String sessionId = hs.getId();//取seesionid在ie下不行。。PrintWriter pw = resp.getWriter();resp.setContentType("text/html charset=utf-8");pw.println("<html>");pw.println("<body>");pw.println("<h1>"+sessionId+"</h1>");pw.println("</body>");pw.println("</html>");}
解决方案
引用resp.setContentType("text/html charset=utf-8"); 少了冒号resp.setContentType("text/html; charset=utf-8");
时间: 2024-08-01 19:39:49