Servlet中Session的使用

参考Struts2中Cookie的使用https://www.cnblogs.com/batj/p/9109295.html

  • 创建Session

HttpSession se = request.getSession();
se.setAttribute("hello", "world");

  • 获取Session

HttpSession se = request.getSession();
System.out.println(se.getAttribute("hello"));

posted @ 2018-05-30 10:31  呦,可以呦  阅读(311)  评论(0编辑  收藏  举报