Under what conditions is a JSESSIONID created?

后端 未结 5 872
灰色年华
灰色年华 2020-11-22 09:34

When / what are the conditions when a JSESSIONID is created?

Is it per a domain? For instance, if I have a Tomcat app server, and I deploy multiple web

5条回答
  •  情歌与酒
    2020-11-22 10:21

    Here is some information about one more source of the JSESSIONID cookie:

    I was just debugging some Java code that runs on a tomcat server. I was not calling request.getSession() explicitly anywhere in my code but I noticed that a JSESSIONID cookie was still being set.

    I finally took a look at the generated Java code corresponding to a JSP in the work directory under Tomcat.

    It appears that, whether you like it or not, if you invoke a JSP from a servlet, JSESSIONID will get created!

    Added: I just found that by adding the following JSP directive:

    <%@ page session="false" %>
    

    you can disable the setting of JSESSIONID by a JSP.

提交回复
热议问题