cookie的基本使用
来源:互联网 发布:怪物猎人x数据库 编辑:程序博客网 时间:2024/05/29 18:19
设置cookie
Cookie cusername = new Cookie("username",username); Cookie cpassword = new Cookie("password",password); //5分钟失效 cusername.setMaxAge(60*5); cpassword.setMaxAge(60*5); response.addCookie(cusername); response.addCookie(cpassword);
读取cookie
if(cookies!=null){ for(Cookie cookie : cookies){ if("username".equals(cookie.getName())){ username = cookie.getValue(); }if("password".equals(cookie.getName())){ password = cookie.getValue(); } }
删除cookie
Cookie cusername = new Cookie("username",null); Cookie cpassword = new Cookie("password",null); cusername.setMaxAge(0); cpassword.setMaxAge(0); response.addCookie(cusername); response.addCookie(cpassword);
1 0
- Cookie的基本使用
- Cookie的基本使用
- cookie的基本使用
- cookie的基本使用
- Cookie的基本使用
- Cookie类基本的使用
- JS中cookie的基本使用
- 学习笔记(二):cookie的基本使用
- JavaScrip中cookie的基本使用
- JS中cookie的基本使用
- jq中cookie的基本使用
- cookie的基本操作
- cookie的基本用法
- Cookie的基本操作
- js对cookie基本使用
- php中 session和cookie的基本使用
- cookie的一些基本操作
- Cookie ,Session的基本用法
- 计算语言学课程笔记(三)
- [网络流最大流经典][uva 11082][矩阵解压]
- Android消息机制使用及详解
- 微软2014校园招聘笔试试题
- 日志:每个软件工程师应该知道的关于实时数据的统一
- cookie的基本使用
- html属性
- cocoaPods的配置与使用
- 【Web Design】课堂笔记
- Codeforces#305-C-Soldier and Cards-暴力模拟-deque
- 【黑马程序员】【Foundation框架】Automatic Reference Count(ARC)
- LA3357 Pinary
- FileUtils
- hdu 1556 Color the ball