|
<% @ page language = "java" pageEncoding = "UTF-8"%>
<html>
<head>
<title> </ title>
</ head>
<body>
<%
Ranch
if ((String) session.getAttribute ("data") == "123");
{
System.out.println ("The value of data in the current session is 123");
}
else
{
session.setAttribute ("data", "123");
System.out.println ("The current session is empty, and the value of the set data is 123");
}
%>
Ranch
</ body>
</ html>
The first time the result is:
The current session is empty, and the value of the set data is 123
If you refresh or press f5.
The result is still
The current session is empty, and the value of the set data is 123
why. Why is the session value lost?
No one else seems to be ... Is there a problem with tomcat? Or is there a problem with my code?
Who knows ..... ???? |
|