• <sub id="h4knl"><ol id="h4knl"></ol></sub>
    <sup id="h4knl"></sup>
      <sub id="h4knl"></sub>

      <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
      1. <strong id="h4knl"></strong>

      2. Java認(rèn)證考試:如何設(shè)置和刪除cookie

        時(shí)間:2024-11-11 14:19:27 JAVA認(rèn)證 我要投稿
        • 相關(guān)推薦

        Java認(rèn)證考試:如何設(shè)置和刪除cookie

          -

        Java認(rèn)證考試:如何設(shè)置和刪除cookie

          /**

          * 刪除cookie

          */

          public static void clearCookie(HttpServletRequest request,HttpServletResponse response, String path) {

          Cookie[] cookies = request.getCookies();

          try{

          for(int i=0;i《cookies.length;i++) {

          //System.out.println(cookies[i]。getName() + “:” + cookies[i]。getValue());

          Cookie cookie = new Cookie(cookies[i]。getName(), null);

          cookie.setMaxAge(0);

          cookie.setPath(path);//根據(jù)你創(chuàng)建cookie的路徑進(jìn)行填寫

          response.addCookie(cookie);

          }

          }catch(Exception ex) {

          System.out.println(“刪除Cookies發(fā)生異常!”);

          }

          }

          public static void setCookie(HttpServletResponse response, String name, String value, String path) {

          if (logger.isDebugEnabled()) {

          logger.debug(“Setting cookie ‘” + name + “’ on path ‘” + path + “’”);

          }

          Cookie cookie = new Cookie(name, value);

          cookie.setSecure(false);

          cookie.setPath(path);

          cookie.setMaxAge(Constants.COOKIE_INVALID_TIME);

          response.addCookie(cookie);

          // logger.info(“setCookie 完成……。”);

          }

          //調(diào)用

          String cookiename = “vbo”;

          String cookievalue = “cb”;

          String path = “/”;

          setCookie(response, cookiename , cookievalue , path);

          clearCookie(request,response,path);//如果有name的話,方法也要增加name過去才能匹配

        《&.doc》
        将本文的Word文档下载到电脑,方便收藏和打印
        推荐度:
        点击下载文档

        【Java認(rèn)證考試:如何設(shè)置和刪除cookie】相關(guān)文章:

        java認(rèn)證考試科目設(shè)置10-24

        php 刪除cookie方法詳解10-24

        JAVA認(rèn)證考試細(xì)則06-10

        java認(rèn)證考試介紹07-31

        Linux認(rèn)證考試科目設(shè)置07-12

        微軟認(rèn)證考試科目設(shè)置07-16

        sun java認(rèn)證考試介紹10-23

        JAVA認(rèn)證考試費(fèi)用06-25

        java認(rèn)證考試細(xì)則介紹08-19

        Sun java認(rèn)證考試答案11-06

        在线咨询
        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码
      3. <sub id="h4knl"><ol id="h4knl"></ol></sub>
        <sup id="h4knl"></sup>
          <sub id="h4knl"></sub>

          <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
          1. <strong id="h4knl"></strong>

          2. 亚洲欧美另类久久久精品能播放的 | 色婷婷综合缴情综e | 天天看影视在线 | 日韩亚洲国产欧美在线 | 午夜在线a亚洲v天堂网2019 | 亚洲伊人久久大香线蕉综合图片 |

            Java認(rèn)證考試:如何設(shè)置和刪除cookie

              -

            Java認(rèn)證考試:如何設(shè)置和刪除cookie

              /**

              * 刪除cookie

              */

              public static void clearCookie(HttpServletRequest request,HttpServletResponse response, String path) {

              Cookie[] cookies = request.getCookies();

              try{

              for(int i=0;i《cookies.length;i++) {

              //System.out.println(cookies[i]。getName() + “:” + cookies[i]。getValue());

              Cookie cookie = new Cookie(cookies[i]。getName(), null);

              cookie.setMaxAge(0);

              cookie.setPath(path);//根據(jù)你創(chuàng)建cookie的路徑進(jìn)行填寫

              response.addCookie(cookie);

              }

              }catch(Exception ex) {

              System.out.println(“刪除Cookies發(fā)生異常!”);

              }

              }

              public static void setCookie(HttpServletResponse response, String name, String value, String path) {

              if (logger.isDebugEnabled()) {

              logger.debug(“Setting cookie ‘” + name + “’ on path ‘” + path + “’”);

              }

              Cookie cookie = new Cookie(name, value);

              cookie.setSecure(false);

              cookie.setPath(path);

              cookie.setMaxAge(Constants.COOKIE_INVALID_TIME);

              response.addCookie(cookie);

              // logger.info(“setCookie 完成……。”);

              }

              //調(diào)用

              String cookiename = “vbo”;

              String cookievalue = “cb”;

              String path = “/”;

              setCookie(response, cookiename , cookievalue , path);

              clearCookie(request,response,path);//如果有name的話,方法也要增加name過去才能匹配