当前位置: 技术问答>java相关
急!在servlet中如何设置session,,又如何取得session的值???
来源: 互联网 发布时间:2015-05-09
本文导语: 如题 | HttpSession session = request.getSession(true); //set session session.setAttribute("name", name); //get session String name = (String)session.getAttribute("name");
如题
|
HttpSession session = request.getSession(true);
//set session
session.setAttribute("name", name);
//get session
String name = (String)session.getAttribute("name");
//set session
session.setAttribute("name", name);
//get session
String name = (String)session.getAttribute("name");