两个页面创建的ID不一样,怎么回事?
session:
%@ page language="java" import="java.text.*" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'session.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<h1>csession内置对象</h1>
<% session.setAttribute("user_name","jinyubao");
SimpleDateFormat s=new SimpleDateFormat("yyyy-MM-dd hh:ss:mm");
Date d=new Date(session.getCreationTime());
%>
创建时间:<%=s.format(d) %>
创建ID:<%=session.getId() %>
用户名:<%=session.getAttribute("user_name")%>
<br>
<a href="session1.jsp" target="_blank">跳转到session1页面</a>
<br>
</body>
</html>
session1:
<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'session.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
创建ID:<%=session.getId()%><br>
用户名:<%=session.getAttribute("user_name")%>
hello world<br>
</body>
</html>
结果:
csession内置对象
创建时间:2016-11-06 10:50:25
创建ID:504B8B68ACB2E47830DB4EC1FE76B4DC
用户名:jinyubao
跳转到session1页面
创建ID:B2A56A9B2F71948FEEA5EE15340C1123
用户名:null
hello world
结果创建的ID不一样,怎么回事?