1 cookie存取:
 2 存: Cookie cookie = new Cookie("title",URLEncoder.encode("标题","utf-8"))
 3          cookie.setMaxAge(365 * 24 * 60 * 60);
 4           response.addCookie(cookie);
 5 取: Cookie[] cookies = request.getCookies();
 6          Cookie sCookie = null;
 7          String cookievalue="";
 8          for(int i = 0; i < cookies.length; i++){
 9                 sCookie = cookies[i];
10                 if(sCookie.getName()!=null&&sCookie.getName().equals("title"))
11                           cookievalues=URLDecoder.decode(sCookie.getValue(),"utf-8");
12          }

 

相关文章:

  • 2021-12-04
  • 2022-12-23
  • 2022-02-24
  • 2022-12-23
  • 2021-09-28
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-21
  • 2022-12-23
  • 2022-01-09
  • 2021-08-31
  • 2022-01-06
  • 2022-12-23
相关资源
相似解决方案