package coreservlets;



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



/** Sets six cookies: three that apply only to the current
* sess " /> 特级xxxxx欧美,风流放荡的艳妇小说,国产精品动漫视频网站

一区二区久久-一区二区三区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的使用,轉載需保留來源!

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

主站蜘蛛池模板: 女人洗澡一级毛片一级毛片 | 亚洲不卡一区二区三区 | 视频一区二区三区在线 | 亚洲国产精品久久婷婷 | 天天摸天天碰中文字幕 | 日本伊人色综合网 | 久久精品免视着国产成人 | 一区二区三区在线观看视频 | 女的毛片毛片毛毛片毛毛毛毛片 | 九一色视频 | 久久大香香蕉国产免费网站 | 婷婷丁香激情五月 | 成年美女网站 | 精品一精品国产一级毛片 | 在线观看免费国产视频 | 国产免费播放一区二区 | 欧美人与物videos另类3d | 美女胸又大又黄的网站 | 六月婷婷综合 | 久久只这里是精品66 | 黄在线视频 | 国产美女激情视频无打码 | 日韩欧美一中文字幕不卡 | 免费 高清 日本视频 | 国产精品福利在线观看免费不卡 | 精品日韩一区二区三区视频 | 在线色 | 欧美午夜性视频 | 奇米第四狠狠777高清秒播 | 色欧美视频 | 国产最新精品视频 | 一区二区免费视频观看 | 亚洲一区视频在线播放 | 国产福利在线永久视频 | 久久www免费人成精品 | 精品国产一区二区三区在线 | 看全色黄大色黄大片色责看的 | 99久久网站 | 久久厕所精品国产精品亚洲 | 国产精品亚洲第一区焦香 | 亚洲图片一区二区三区 |