A页面跳转到B页面后,按返回按钮,返回页面A后并没有继续处理,而是卡住了,原因是jsp页面被浏览器缓存了。因此需要禁用Jsp页面缓存。
正确的做法:
<%@ page contentType="text/html;charset=UTF-8" %>
<%
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
response.setDateHeader("Expires", -1);
%>
在jsp页面通过response设置header禁用cache就可以了,亲测可用。
网上有说在页面设置header,如下所示:
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
这个我试过了,没有效果。
本文介绍了解决JSP页面缓存导致的返回按钮异常问题的方法。通过在JSP页面中使用response设置header来禁用缓存,避免了页面在浏览器中的缓存,确保页面的正确处理和刷新。实验证明,此方法有效。

389

被折叠的 条评论
为什么被折叠?



