<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新闻信息管理系统</title>
<!-- 让超链接后的页面在显示页面的右下部分显示 -->
<!--<base target="rightFrame"/>-->
<link type="text/css" rel="stylesheet" href="../../css/common.css"/>
<script type="text/javascript">
function close(){
window.location="<%=request.getContextPath() %>/jsp/listener/doOut.jsp";
}
</script>
</head><body onunload="close();">
<!--页面顶部-->
<jsp:include page="/jsp/listener/online.jsp"></jsp:include>
<jsp:include page="adminTop.jsp"></jsp:include>
<!--页面中部-->
<div id="content" class="main-content clearfix">
<jsp:include page="adminSidebar.jsp"></jsp:include>
<jsp:include page="adminRightbar.jsp"></jsp:include>
</div>
<!--页面底部-->
<jsp:include page="adminBottom.jsp"></jsp:include>
</body>
</html>
doOut.jsp页面如下 :<%@page language="java" contentType="text/html; utf-8" pageEncoding="utf-8"%><%
session.invalidate();//使session失效,同时执行User类中的valueUnbound()方法
response.sendRedirect("login.jsp");
%>
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新闻信息管理系统</title>
<!-- 让超链接后的页面在显示页面的右下部分显示 -->
<!--<base target="rightFrame"/>-->
<link type="text/css" rel="stylesheet" href="../../css/common.css"/>
<script type="text/javascript">
function close(){
window.location="<%=request.getContextPath() %>/jsp/listener/doOut.jsp";
}
</script>
</head><body onunload="close();">
<!--页面顶部-->
<jsp:include page="/jsp/listener/online.jsp"></jsp:include>
<jsp:include page="adminTop.jsp"></jsp:include>
<!--页面中部-->
<div id="content" class="main-content clearfix">
<jsp:include page="adminSidebar.jsp"></jsp:include>
<jsp:include page="adminRightbar.jsp"></jsp:include>
</div>
<!--页面底部-->
<jsp:include page="adminBottom.jsp"></jsp:include>
</body>
</html>
doOut.jsp页面如下 :<%@page language="java" contentType="text/html; utf-8" pageEncoding="utf-8"%><%
session.invalidate();//使session失效,同时执行User类中的valueUnbound()方法
response.sendRedirect("login.jsp");
%>
解决方案 »
- 求解答、想输出一个树形菜单,空指针、一直进不去执行实现方法、
- 多线程问题
- jasperReport
- 我的EJB程序,为什么无法生成EJB TEST CLIENT 。
- session和string比较问题
- 深度探索:1.如何检查数据库connection是否关闭.2,找到在哪个类里创建的这个连接.打印出类名.
- 使用mysql数据库,为什么在struts struts-config.xml当中配置data-sources中的数据源却不能正确使用呢?
- 花100分 求, java 的 util 包 问题????????
- jtree和xml。。。
- 如何进行对java项目的布局配置(各种框架的配置)
- freemarker如何显示cookie
- Tomcat里boneCP的使用问题
通过超链的方式是可以关闭会话的,我问的是怎么让它关闭jsp页面的时候关才会话?
或是当全部打开的IE窗口关闭时 session会自动失效
楼主这个问题是否已经解决了呢?我最近也遇到了类似的需求,我找到了另一种思路来实现这个功能不过这个方法也是不尽人意啊 实现不了跳转总与逻辑相驳。我贴出我的代码(也是在网上搜的)window.onload = function(){
var is_asked = false;
window.onbeforeunload = function (ev) {
var e = ev || window.event;
windowFocus();
if (!is_asked){
is_asked = true;
var showstr = "CUSTOM_MESSAGE";
if (e) { //for ie and firefox
e.returnValue = showstr;
}
return showstr; //for safari and chrome
}
};
var windowFocus = function (ev){
alert(ev||is_asked);
if (is_asked){
window.location.href = "http://www.google.com";
}
};
};