如何通过jsessionid找到session
我知道一个jsessionid,那么如何找到匹配的session,就是说如何调用原session而不是新生成一个session?
first.jsp
<html>
<body scroll="no" background="<%=request.getContextPath()%>/login/registeredUser/USA/loginBGLine.jpg">
<% out.println(session.getId());
session.setAttribute("test","sessionTest");
%>
<a href="testSession.jsp" >link to testSession</a>
</body>
</html>
testSession.jsp
<html>
<body scroll="no" background="<%=request.getContextPath()%>/login/registeredUser/USA/loginBGLine.jpg">
<% out.println(session.getId());
//HttpSession s = new HttpSession();
out.println("tesst="+session.getAttribute("test"));
out.println("request.isRequestedSessionIdFromURL()="+request.isRequestedSessionIdFromURL());
%>
</body>
</html>
我通过first.jsp访问testSession.jsp就能得到数据。
假设我通过这样的方式访问了一次以后,我重新开启浏览器,这时候也知道了jseesionid,那我如何取得相应数据呢?