jsp源码实例5(cookie) - JSP编程论坛 - 脚本交流论坛 软件下载网|软件下载论坛|软体下载|软件分享 - Powered by Discuz! 亚博世界杯app,亚博网上投注,yabo体育网
发新话题
打印

jsp源码实例5(cookie)

jsp源码实例5(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).
*
* 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\n" +
"" + title + "\n" +
"There are six cookies associated with this page.\n" +
"To see them, visit the\n" +
"
[url=\"/servlet/coreservlets.ShowCookies\"]\n" +
"ShowCookies servlet[/url]
.\n" +
"\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" +
"ShowCookies servlet to verify that\n" +
"the three long-lived ones persist across sessions.\n" +
"");
}
}

TOP

发新话题
最近访问的版块
[hide][/hide]