首页 > 代码库 > cookie/session

cookie/session

=================================session

String name = request.getParameter("name‘);

HttpSession session =  request.getsession();

session.setAttribute("sessionKey",name);

session.setAttribuet("sessionKey");

session.removeAttribute("key");

session.invalidate();//删除所有session中保存的键

===================================cookie

 

String name = request.getParameter("name");

name = java.net.URLEncoder.encode("name","UTF-8");

Cookie cookie = new Cookie("cookieKey",name);

cookie.setMaxAge(60);//六十秒

response.addCookie(cookie);

?????循环遍历取cookie时候,

 

cookie/session