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

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

主站蜘蛛池模板: 伊人色在线 | 一级一级女人18毛片 | 看全色黄大色黄大片色责看的 | www.91麻豆| 综合激情区视频一区视频二区 | 开心激情五月网 | 免费观看国产一区二区三区 | 六月婷婷开心 | 91亚洲精品色午夜麻豆 | 激情在线观看视频免费的 | 中文字幕一区二区三区四区五区 | 日日摸夜夜添夜夜添人人爽 | 伊人久久精品久久亚洲一区 | 日日好吊妞| 国产一区免费在线观看 | 老司机日日摸夜夜摸精品影院 | a级国产乱理论片在线观看 a级国产乱理论片在线观看看 | 欧美黄色片在线 | 91免费国产在线观看 | 国产原创中文视频 | 深夜小视频在线观看 | 隔壁搬来黑人巨大中文字幕 | 国产精品高清全国免费观看 | 国内自拍网址 | 国产伦精品一区二区三区 | www激情网 | 国产精选第一页 | 91中文字幕在线一区 | 亚洲欧美在线免费 | 激情小视频网站 | 国产小视频在线播放 | 97久久精品国产精品青草 | 久久精品无码一区二区日韩av | 噜色 | 免费超爽大片黄网站 | 91视频观看 | 在线国产一区二区 | 色播在线视频 | 亚洲天堂图片 | 国产自在线 | 婷婷sese|