为了账号安全,请及时绑定邮箱和手机立即绑定

配置拦截器后JSP页面找不到引用的javascript

配置拦截器后JSP页面找不到引用的javascript

海绵宝宝撒 2019-04-26 18:19:55
拦截器配置成功后原jsp页面引用的js404了js引用如下 <script type='text/javascript' src='<%=basePath%>admin/js/aclock.js'></script>     <script type="text/javascript" src="<%=basePath%>admin/eventJS/sharingJS.js"></script>web.xml如下: <filter>         <filter-name>Login</filter-name>         <filter-class>com.xxxx.Util.LoginFilter</filter-class>         </filter>     <filter-mapping>         <filter-name>Login</filter-name>         <url-pattern>/admin/*</url-pattern>         <url-pattern>/views/*</url-pattern>     </filter-mapping>     <servlet-mapping>         <servlet-name>default</servlet-name>         <url-pattern>/js/*</url-pattern>         <url-pattern>/css/*</url-pattern>         <url-pattern>/images/*</url-pattern>     </servlet-mapping>拦截器如下: public void doFilter(ServletRequest arg0, ServletResponse arg1,             FilterChain arg2) throws IOException, ServletException {         HttpServletRequest req = (HttpServletRequest) arg0;         HttpServletResponse resp = (HttpServletResponse) arg1;         HttpSession session = req.getSession();         String path = req.getRequestURI();         System.out.println(path);         String admin_account = (String) session.getAttribute("admin_account");      if(path.indexOf("image.jsp") > -1){              arg2.doFilter(req, resp);              return;          }else {// 如果不是login.jsp进行过滤              if (admin_account == null || "".equals(admin_account)) {                     resp.sendRedirect("/stone-bi/index.jsp");                 } else {                     // 已经登陆,继续此次请求                     arg2.doFilter(req, resp);                 }          }     }
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 534 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信