Kill session and redirect to login page on click of logout button

后端 未结 3 822
我寻月下人不归
我寻月下人不归 2021-02-06 02:05

I have the following code in JSP:

<%
    if(session.getAttribute(\"Username\") == null || session.getAttribute(\"Username\") == \"_INVALID_\")
    {
        r         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-06 02:14

    You should take a look at the invalidate() method of HttpSession. The session can be retrieved via HttpServletRequest getSession() method.

    You should also take a look at Expires, Cache-Control, Pragma http headers, as in: Prevent user from going back to the previous secured page after logout .

提交回复
热议问题