您当前的位置: 首页 >  servlet

wespten

暂无认证

  • 3浏览

    0关注

    899博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

servlet过滤器与监听器

wespten 发布时间:2018-08-12 10:57:29 ,浏览量:3

对登录过滤不能直接访问main主页面

path排除登录的情况

public class LoginFilter implements Filter{

	public void destroy() {
		// TODO Auto-generated method stub
		
	}

	public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
			FilterChain filterChain) throws IOException, ServletException {
		HttpServletRequest request=(HttpServletRequest)servletRequest;
		HttpSession session=request.getSession();
		Object o=session.getAttribute("currentUser");
		String path=request.getServletPath();
		if(o==null&&path.indexOf("login")            
关注
打赏
1665965058
查看更多评论
0.0414s