惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
罗磊的独立博客
F
Fortinet All Blogs
T
Threatpost
Y
Y Combinator Blog
博客园_首页
美团技术团队
Security Latest
Security Latest
博客园 - 三生石上(FineUI控件)
T
Tailwind CSS Blog
V
V2EX - 技术
The Cloudflare Blog
L
LINUX DO - 热门话题
博客园 - 司徒正美
Jina AI
Jina AI
P
Proofpoint News Feed
宝玉的分享
宝玉的分享
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
The Hacker News
The Hacker News
P
Privacy International News Feed
T
The Exploit Database - CXSecurity.com
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
M
MIT News - Artificial intelligence
Latest news
Latest news
NISL@THU
NISL@THU
Google DeepMind News
Google DeepMind News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cisco Blogs
雷峰网
雷峰网
Application and Cybersecurity Blog
Application and Cybersecurity Blog
B
Blog RSS Feed
W
WeLiveSecurity
D
DataBreaches.Net
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
GRAHAM CLULEY
Spread Privacy
Spread Privacy
Know Your Adversary
Know Your Adversary
TaoSecurity Blog
TaoSecurity Blog
S
Securelist
Help Net Security
Help Net Security

博客园 - IT战神

[评论]为什么程序员的社会地位不高?--转载 转载--解决PowerDesigner 反向工程没有列注释(SQLSERVER 2005版) , 获取相对路径 (c#) 数据库优化(转载) Linq to Entities实例 asp.net开源项目及学习资料 C#.net同步异步SOCKET通讯和多线程总结 winform的ftp方式上传 - IT战神 - 博客园 ms agent 精灵 带右键菜单c# c#面实题及答案 哲理人生 - IT战神 - 博客园 创业 史玉柱经典语录(转) jsp 面试题 regsvr32 注册大全 DotNet控件开发的资料列表(共享) ie6 和ie7版本带来的一个奇怪的中文乱码问题(长度为奇数时最后一个字符会出现乱码)(原创) uml 图解 xtree,不错的javascript树
jsp cookie 中文乱码 的解决方法
IT战神 · 2008-11-18 · via 博客园 - IT战神

保存cookie

String value = java.net.URLEncoder.encode("你需要保存的中文");
      

      Cookie namecookie = new Cookie("draftflow_username",value);
      //Cookie usercookie = new Cookie("draftflow_user",user);
      namecookie.setMaxAge(60*60*24*30*365);
      namecookie.setPath("/");
      response.addCookie(namecookie);

读取 cookie

Cookie[] cookies = request.getCookies();
  if(cookies!=null)
  {
      String name = "";
            for (int i = 0; i < cookies.length; i++)
      {
         Cookie c = cookies[i];    
         if(c.getName().equalsIgnoreCase("draftflow_username"))
         {
            name =java.net.URLDecoder.decode(c.getValue());//解码
          }

       }