HttpSession hs = request.getSession();//以键值对方式存储数据在session中hs.setAttribute("code", code);//设置这个session生存周期为30分钟,单位是秒hs.setMaxInactiveInterval(30*60);