checking session in servlet and jsp

前端 未结 2 1461
日久生厌
日久生厌 2021-02-14 01:57

In my web application i neet to check session already exist or not.

i want to check this in my servlet and in jsp also.

is there any way to check this.

T

2条回答
  •  一生所求
    2021-02-14 02:32

    One way is to set a session id in the jsp and then check the same session id in the other jsp or servlet to check if it is alive or not.

    HttpSession session = req.getSession();
            session.getId();
    

提交回复
热议问题