Difference between request.getSession().getId() and request.getSession(false)?

前端 未结 8 725
礼貌的吻别
礼貌的吻别 2021-01-31 04:08

What do these calls actually mean in terms of session?

System.out.println(\"print1: \"+request.getSession().getId());
System.out.println(\"print2: \"+request.get         


        
8条回答
  •  梦毁少年i
    2021-01-31 04:48

    request.getSession().getId();
    

    returns the unique identifier assigned to this session. And It has return type of String.

    request.getSession(false)
    

    returns the HttpSession object if it already exists else return null.

提交回复
热议问题