转载:https://zhidao.baidu.com/question/142779854.html

request:请求
getRequestURI:获取请求的url
indexOf(str):求字符串内str出现的位置下标
所以:request.getRequestURI().indexOf("1.jsp")的意思就是,求请求的url内“1.jsp”的位置,返回的是一个数字,代表出现的位置,-1表示不存在。通常和-1比较来表示是否包含指定的页面,常用于过滤器。
例:if(request.getRequestURI().indexOf("1.jsp")){
filterChain.doFilter(request,response);//给1.jsp放行

}else{
xxxxxx//不放行,进行别的操作

}

相关文章:

  • 2022-12-23
  • 2021-12-04
  • 2021-11-17
  • 2021-12-19
  • 2021-11-19
  • 2021-08-06
  • 2021-08-07
猜你喜欢
  • 2022-12-23
  • 2022-01-14
  • 2021-05-07
  • 2021-05-22
  • 2021-12-24
  • 2021-09-07
  • 2021-08-04
相关资源
相似解决方案