Also talk about the inconsistency in JSP and Servlet

zhaozj2021-02-16  53

When I handled the session variable today, I was a bit dizzy by a session problem.

The error is like this: I have no mistakes in this machine, and other machines of the LAN access to my machine, choose the first classification, set a "SID" "1" session, go to a page, at this time SESSION takes out "SID" to get "1". Then I select the second classification, set the value of "SID" to "2", then go to another page, then remove the "SID" from the session, the value obtained is actually "1".

I first print from the background, but when choosing the second classification, "SID" is still "1". It seems that the session is still the first time when the page is from servlet to JSP, and there is no update. So I added a code to prevent IE read cache:

Response.setHeader ("Cache-Control", "NO-Store"); Response.setHeader ("Pragma", "No-cache"); Response.SetDateHeader ("Expires", 0);

The problem is finally resolved.

转载请注明原文地址:https://www.9cbs.com/read-23740.html

New Post(0)