本人用jsp做了一个简易的bbs论坛网站,利用cookies存储用户数据,实现一个注销功能,类似csdn论坛的注销,即清除cookies中的数据。重新访问首页时不会显示个人信息。请问各位该如何实现?
解决方案 »
- 关于jsp下载文件的功能。
- 不显示删除回复显示所有回复显示星级回复显示得分回复 访问时老是出现一下异常。不知道是什么意思。望各位高手解决下。十分感谢!急急急!!!
- java基础,散分
- 求教java的构造顺序?
- 我在公司做过四个月的jsp 我现在想到广东 ,上海 ,北京,等地找工作,开始的工资是??
- Servlet如何访问位于另外app server中的Servlet获得数据
- 验证码“看不清”功能的实现
- tomcat启动慢 报错不引响 求指导
- 请教一个关于tomcat编码,websphere,sql server 2000编码的问题!内详细叙述
- 一个表单提交不能用回车的奇怪现象?
- java 无法定位程序输入点 getaddrinfo 于动态链接库ws2_32.dll上。
- jsp网站,有登陆页面,主框架、主框架中有用户管理、货架管理、物品管理等,那么用uml的use case怎样把这些描述出来?
有关时间的函数,忘记是啥了
response.xxxxxxxxx
public void setMaxAge(int expiry)
Sets the maximum age of the cookie in seconds.
A positive value indicates that the cookie will expire after that many seconds have passed. Note that the value is the maximum age when the cookie will expire, not the cookie's current age. A negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits.
A zero value causes the cookie to be deleted.
当你设置cookie的生命周期值1,为正数的时候,那么就会生存你所指定的时间;2:为负数的时候,将会在浏览器退出的时候清除掉;3:如果设置为0那么立即清理掉
//删除cookie
function removeCookie(name){
document.cookie = name+"=;expires="+(new Date(0)).toGMTString();
}
把COOKIE的时间 TIMEOUT设置为-1 负数即可。