<%/**
测试Session的两个方法
*/
%>
<%@ page errorPage="errorpage.jsp" %>
<html>
<head>
<title>Session Example</title>
</head>
<body>
<%
Integer count = (Integer)session.getAttribute("COUNT");
if ( count == null )
{
// If the count was not found create one
count = new Integer(1);
// and add it to the HttpSession
session.setAttribute("COUNT", count);
}
else
{
// Otherwise increment the value
count = new Integer(count.intValue() + 1);
session.setAttribute("COUNT", count); //重新调置这个值
}
out.println("<b>You have accessed this page: "+ count + " times.</b>");
%>
</body>
</html>