5
To invalidate a session, my teacher passed the following code:
HttpSession session = request.getSession(false);
if (session!=null){
session.invalidate();
}
But after the logout, when I click Back in the browser, I can recover the same one I logged in. How can I delete it? Thanks in advance!
The method to invalidate the session is this. You created the security part or are using some framework?
– adelmo00
Hello oveRider. The invalidate method does what you want. See if your browser is not caching the previous page, How this is solved is by adding some headers to the reply.
– Anthony Accioly
The method is correct, only this should be enough to disconnect the user, if you are not using some "Remember Me" feature. I don’t think the problem is there.
– Sidney
You updated the page after returning?
– José Roberto Araújo Júnior