[Java] 纯文本查看 复制代码
@WebServlet("/sessionDemo5")
public class SessionDemo5 extends HttpServlet {
protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession();
System.out.println(session);
System.out.println(session.getId());
response.setContentType("text/html;charset=utf-8");
String path = response.encodeURL("/day16/sessionDemo6");
System.out.println(path);
response.getWriter().print("<a href='" + path + "'>点击</a>");
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);
}
}