You need to set the browser caching for the previous pages to not cahce the pages. Search the forum for how to add the correct header tags to you JSP pages.
Then on each page or backing servlet you'll need to check the session to ensure that it is still valid. This is done by adding a user token to the session on log in and removing the token or invalidating the session on log out. Just checking for the existance of a session will not worfk because JSP automatically create sessions.