How to effectively destroy 'session' in Java Servlet?

前端 未结 2 1302
遇见更好的自我
遇见更好的自我 2020-12-28 17:11

The Servlet I\'m working has a variable session.

I\'ve tried session.invalidate();, this seem to have destroyed session but when I do a red

2条回答
  •  攒了一身酷
    2020-12-28 18:06

    Your code is okay

    if(request.getParameter("logout") != null )
    {  
      session.invalidate();
      response.sendRedirect("restanes.jsp");
    }
    

    but make sure the redirecting page does not contain any session attributes. 500 internal error coming from "restanes.jsp" page. work out with the redirected page and session activity.

提交回复
热议问题