- 18
- 0
- 约1.81万字
- 约 87页
- 2017-06-24 发布于湖北
- 举报
第五章JSP内置对象(简化)
所有的Cookie是由服务器端设置到客户端上去的,所以要向客户端增加Cookie的话,必须使用response对象的以下方法: public void addCookie(Cookie cookie) %@ page contentType=text/html pageEncoding=GBK% html headtitleresponse_demo06.jsp/title/head body % Cookie c1 = new Cookie(lxh,LiXingHua) ; Cookie c2 = new Cookie(mldn,www.MLDNJAVA.cn) ; c1.setMaxAge(60) ; c2.setMaxAge(60) ; // Cookie保存60秒 response.addCookie(c1) ; // 向客户端增加Cookie response.addCookie(c2) ; // 向客户端增加Cookie % /body /html %@ page contentType=text/html pageEncoding=GBK% html headtitleresponse_demo07.jsp/title/head body % Cookie c[] = request.getCookies() ; // 取得全部的Cookie
原创力文档

文档评论(0)