Difference between request.getSession() and request.getSession(true)

后端 未结 7 1739
难免孤独
难免孤独 2021-01-31 08:43

I understand the difference between request.getSession(true) and request.getSession(false). But request.getSession() & request.g

7条回答
  •  余生分开走
    2021-01-31 09:02

    request.getSession() will return a current session. if current session does not exist, then it will create a new one.

    request.getSession(true) will return current session. If current session does not exist, then it will create a new session.

    So basically there is not difference between both method.

    request.getSession(false) will return current session if current session exists. If not, it will not create a new session.

提交回复
热议问题