1. <tt id="5hhch"><source id="5hhch"></source></tt>
    1. <xmp id="5hhch"></xmp>

  2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

    <rp id="5hhch"></rp>
        <dfn id="5hhch"></dfn>

      1. Java認證考試:如何設置和刪除cookie

        時間:2024-11-11 14:19:27 JAVA認證 我要投稿
        • 相關推薦

        Java認證考試:如何設置和刪除cookie

          -

        Java認證考試:如何設置和刪除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);//根據你創建cookie的路徑進行填寫

          response.addCookie(cookie);

          }

          }catch(Exception ex) {

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

          }

          }

          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 完成……。”);

          }

          //調用

          String cookiename = “vbo”;

          String cookievalue = “cb”;

          String path = “/”;

          setCookie(response, cookiename , cookievalue , path);

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

        【Java認證考試:如何設置和刪除cookie】相關文章:

        java認證考試科目設置10-24

        php 刪除cookie方法詳解10-24

        JAVA認證考試細則06-10

        java認證考試介紹07-31

        Linux認證考試科目設置07-12

        微軟認證考試科目設置07-16

        sun java認證考試介紹10-23

        JAVA認證考試費用06-25

        java認證考試細則介紹08-19

        Sun java認證考試答案11-06

        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码

        1. <tt id="5hhch"><source id="5hhch"></source></tt>
          1. <xmp id="5hhch"></xmp>

        2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

          <rp id="5hhch"></rp>
              <dfn id="5hhch"></dfn>