刷新浏览器上的jsp页面后退按钮单击 [英] Refresh a jsp page on browser back button click

查看:173
本文介绍了刷新浏览器上的jsp页面后退按钮单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告知如何在浏览器后退按钮单击上刷新jsp页面.

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 -

如何控制在所有浏览器中都可以进行网页缓存?
在JSP中添加Expires或Cache-Control标头

但是这些链接可能很旧,并且在最新的浏览器上,还有其他方法可以刷新浏览器后退按钮上的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.

感谢您的帮助!

更新-

我应该添加我要实现的目标的详细信息- 我有第一页(jsp),具有表单(更新/关闭票证).提交该表格后,我将显示第二页(jsp),其中包含谢谢您的留言!".从第2页开始,如果用户单击浏览器后退按钮,它将再次将我带到第1页. 我想刷新单击页面2上的后退按钮时的页面1,以便如果用户最初更新/关闭了票证,则显示刷新的页面1以避免不必要的操作.

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.

请告知如何在浏览器后退按钮单击上刷新jsp页面.

Please advise how can I refresh a jsp page on a browser back button click.

推荐答案

在执行更新服务器的任何操作的JSP/servlet的末尾始终使用response.sendRedirect(...); return;,然后不必担心后退按钮.

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.

这篇关于刷新浏览器上的jsp页面后退按钮单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆