设置Cookie的作用范围

cookie.setPath(request.getContextPath());//——>/项目名

cookie的作用范围:可以作用当前目录和当前目录的子目录,但不能作用于当前目录的上一级目录。

可以通过setPath方法来设置Cookie的作用范围,其中/代表站点的根目录。

相关文章:

  • 2021-06-05
  • 2021-10-11
  • 2022-01-15
  • 2021-12-27
  • 2021-12-19
  • 2021-12-25
  • 2022-12-23
  • 2021-11-17
猜你喜欢
  • 2022-12-23
  • 2021-08-11
  • 2021-06-29
  • 2022-02-03
  • 2021-11-20
  • 2021-06-02
相关资源
相似解决方案