package coreservlets;



import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;



/** Sets six cookies: three that apply only to the current
* sess " /> 视频色版,香蕉综合在线,一级毛片区

一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

jsp實現cookie的使用


package coreservlets; 



import Java.io.*; 
import Javax.servlet.*; 
import Javax.servlet.http.*; 



/** Sets six cookies: three that apply only to the current 
* session (regardless of how long that session lasts) 
* and three that persist for an hour (regardless of 
* whether the browser is restarted). 
* <P> 
* Taken from Core Servlets and JavaServer Pages 
* from Prentice Hall and Sun Microsystems Press, 
* http://www.coreservlets.com/. 
* © 2000 Marty Hall; may be freely used or adapted. 
*/ 



public class SetCookies extends HttpServlet { 
public void doGet(HttpServletRequest request, 
HttpServletResponse response) 
throws ServletException, IOException { 
for(int i=0; i<3; i++) { 
// Default maxAge is -1, indicating cookie 
// applies only to current browsing session. 
Cookie cookie = new Cookie("Session-Cookie-" + i, 
"Cookie-Value-S" + i); 
response.addCookie(cookie); 
cookie = new Cookie("Persistent-Cookie-" + i, 
"Cookie-Value-P" + i); 
// Cookie is valid for an hour, regardless of whether 
// user quits browser, reboots computer, or whatever. 
cookie.setMaxAge(3600); 
response.addCookie(cookie); 

response.setContentType("text/html"); 
PrintWriter out = response.getWriter(); 
String title = "Setting Cookies"; 
out.println 
(ServletUtilities.headWithTitle(title) + 
"<BODY BGCOLOR=/"#FDF5E6/">/n" + 
"<H1 ALIGN=/"CENTER/">" + title + "</H1>/n" + 
"There are six cookies associated with this page./n" + 
"To see them, visit the/n" + 
"<A HREF=/"/servlet/coreservlets.ShowCookies/">/n" + 
"<CODE>ShowCookies</CODE> servlet</A>./n" + 
"<P>/n" + 
"Three of the cookies are associated only with the/n" + 
"current session, while three are persistent./n" + 
"Quit the browser, restart, and return to the/n" + 
"<CODE>ShowCookies</CODE> servlet to verify that/n" + 
"the three long-lived ones persist across sessions./n" + 
"</BODY></HTML>"); 


jsp技術jsp實現cookie的使用,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 激情小说亚洲图片 | 天天在线天天综合网色 | 精品福利视频一区二区三区 | 国产福利亚洲 | 国产偷2018在线观看午夜 | 激情在线视频 | 9久9久女女热精品视频免费观看 | 91精品国产麻豆91久久久久久 | 日韩中文字幕一在线 | 久久一日本道色综合久久m 久久伊人草 | 思99re久久这里只有精品首页 | 久在草影院 | 中国女人真人一级毛片 | 看大片全色黄大色黄 | 狠狠色狠狠色综合网 | 国产精品极品美女免费观看 | 一区二区三区不卡免费视频97 | 丁香婷婷六月天 | 国产精品二区高清在线 | 玖玖精品在线 | www色视频在线观看 www色在线 | 国产第一页久久亚洲欧美国产 | 欧美xxxwww| 国产第一页视频 | 俏佳人忘忧草wyc.ia | 国产精品精品 | 国产在线播| 成年人天堂 | 色视频免费看 | 亚洲无吗在线视频 | 精品久久久久久午夜 | 国产精品露脸国语对白手机视频 | 五月婷婷激情在线 | 久久婷婷伊人 | 免费777my性欧美另类 | 国产一区二区视频在线观看 | 色久激情| 国产亚洲一区二区三区在线 | 国产精品免费αv视频 | 精品国产一区二区三区不卡在线 | 国产成人在线播放 |