There are many ways of doing what you want. One of them is to keep a flag in the session and invalidate the session when the back button is clicked. You can catch the "back button" event using a JS function.
You could also keep the "current displayed" as a
String or some ID that represents the page in the session and if the user leaves the page via a browser's button, depending on your business logic, if that's a no-no, you can once again invalidate the session and redirect user to an error page.
Maybe another way would be to alert the user on back button press that if he continues, his session will be invalidated?
You should also check server documentation, there may be already an implemented service .. or some kind of listner that waits for the "back button event" .. and invalidates the session.
I hope this helps
-stan