检测session用户信息跳转首页界面

方案一:采用jsp方式检测用户信息跳转

<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.bim.bdip.cloud.home.model.BimUser"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
// 判断session中的值
BimUser bimUser = (BimUser)request.getSession().getAttribute("LoginSessionUser");
if(bimUser==null) {
    %>
    <script type="text/javascript">
    var basePath = '<%=basePath %>';
    top.location.href = basePath + '/page/bdip/user/logins';
    </script>
    <%
}
%>

方案二 :采用springmvc 的拦截器

方案三 : 采用shiro过滤器

posted @ 2018-01-17 15:11  hoey94  阅读(201)  评论(0编辑  收藏  举报