解决:在点击用户退出登录时,再按浏览器的后退按钮,仍然能够看到之前的页面

之前搜了好多解决方案,基本都是要么在jsp中清除缓存,要么在Action中清除缓存,都没尝试成功,最后找到了一种方便的方法——

在框架frameset制作的管理系统中,在index.jsp中加入下面js代码:

<script language='javascript'>
history.go(1);
</script>

另外附上index.jsp作为参考:

<%@ page language="java" import="java.util.*" contentType="text/html; charset=gbk"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>思华就在您身边!</title>
<script language='javascript'>
history.go(1);
</script>
<meta http-equiv=Content-Type content=text/html;charset=gb2312>
</head>
<s:if test="#session.user == null">
  	<c:redirect url="error.jsp"></c:redirect>
  </s:if>
<frameset rows="64,*"  frameborder="NO" border="0" framespacing="0">
	<frame src="top.jsp" noresize="noresize" frameborder="NO" name="topFrame" scrolling="no" marginwidth="0" marginheight="0" target="main" />
  <frameset cols="200,*"  rows="560,*" id="frame">
	<frame src="left.jsp" name="leftFrame" noresize="noresize" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" target="main" />
	<frame src="right.jsp" name="main" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" target="_self" />
  </frameset>
</frameset>
<noframes>
  <body></body>
    </noframes>
</html>





  • 10
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值