<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                [TOC] ![](https://img.kancloud.cn/2a/c5/2ac5901bba57a977056b4601310caa60_1357x530.gif) ## 問題01:cookie是什么? cookie是小段的文本信息,可以標識用戶身份,記錄用戶名和密碼,跟蹤重復用戶等。 cookie是在網絡**服務器上生成**,并發送給瀏覽器的。并以**key/value**的形式保存到**客戶機**的某個指定目錄中。 ## 問題02:cookie的增刪改查? ### 1. cookie的寫入 ``` Cookie cookie = new Cookie("name","value"); response.addCookie(cookie); ``` > **cookie不能保存中文** > **void javax.servlet.http.HttpServletResponse.addCookie(Cookie cookie)** > Adds the specified cookie to the response. This method can be called multiple times to set more than one cookie. ### 2. 設置cookie的存活時間 ```cookie.setMaxAg(int seconds) ``` > void javax.servlet.http.Cookie.setMaxAge(int expiry) > **Parameters**: expiry an integer specifying the maximum age of the cookie **in seconds**; if **negative**, meansthe cookie is **not stored**; if **zero**, **deletes** the cookie. ### 3. 獲取cookie數組 ```request.getCookies();``` * [ ] 獲取指定cookie的name ```cookie.getName() ``` * [ ] 獲取指定cookie的value ```cookie.getValue() ``` ### 4. EL讀取cookie ``` ${cookie.XXX.value} ``` ## 問題03:保存中文Cookie ``` URLEncoder.encode(value,"UTF-8")) ``` > **如果需要使用EL表達式讀取中文cookie,則可以使用自定義標簽庫,編寫解碼函數** ``` ${custom:decoder(cookie.XXX.value,'UTF-8') } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看