boolean sessionTimeOut = false;
if (exception != null) {
if (exception.getCause() instanceof com.chinacreator.security.SessionTimeoutExcetpion){
//response.sendRedirect(request.getContextPath());
//return;
sessionTimeOut = true;
}
}
<div Style="width: 100%; display: none" id="exceptionDiv">
<img src="../include/themes/default/images/messager_error.gif" />
<a onClick="javascript:showT();" href="#">查看详细异常</a>
<div id='exceptions'
style="display: none; OVERFLOW: auto; width: 100%; height: 460">
<pre>
<%
exception.printStackTrace(new java.io.PrintWriter(out));
%>
</pre>
</div>
</div>
<script type="text/javascript"> <!-- var isTopOtherSystem = false;//最上层窗口是不是本系统 //返回层级窗口 function findOpenerWin(win){ var openerWin = win.top.dialogArguments; if (!openerWin){ openerWin = win.top.opener; } if (openerWin){ try { openerWin.top.document.location; } catch(e) { isTopOtherSystem = true; } if (isTopOtherSystem){ return openerWin; } return findOpenerWin(openerWin) } else{ try { win.top.document.location; } catch(e) { isTopOtherSystem = true; } } return win; } if (<%=sessionTimeOut%>){ var openerWin = findOpenerWin(this); alert("会话超时,请重新登录!"); //如果本窗口就是原始窗口 if (openerWin == this){ this.top.location.href = "<%=request.getContextPath()%>"; } else{ //关闭当前窗口 this.close(); //如果没有跨域 ,即原始窗口不是其他系统 if (!isTopOtherSystem){ openerWin.top.location.href = "<%=request.getContextPath()%>"; } } } else{ document.getElementById("exceptionDiv").style.display = "block"; } //--> </script>