Always use response.sendRedirect(...); return;
at the end of any JSP/servlet that does anything that updates the server, and then don't worry about the back button.
Refresh a jsp page on browser back button click
-
19-10-2022 - |
Question
Please advise how can I refresh a jsp page on a browser back button click.
I saw a lot of questions , articles on this but nothing helped me. Tried pointers from these questions -
How to control web page caching, across all browsers? ,
Add an Expires or a Cache-Control header in JSP
but may be these links are pretty old and on latest browsers there is some other way to refresh a jsp page on browser back button? please advise.
Thanks for your help!
Update -
I should have added the details of what I am trying to achieve - I have 1st Page (jsp) which is having a form (update / close your ticket). On submission of that form i show 2nd page (jsp) which contains "thank you message!". From page 2 if user hits browser back button it again takes me to 1st page. I want to refresh the page 1 on a back button click from page 2, so that if user updated/ closed the ticket initially , I display the refreshed page 1 to avoid the unwanted actions.
Please advise how can I refresh a jsp page on a browser back button click.
Pas de solution correcte
Autres conseils