方案一:采用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过滤器