本文实例讲述了java设置session过期时间的实现方法,分享给大家供大家参考。具体实现方法如下:
1、timeout in the deployment descriptor (web.xml)
以分钟为单位
2、timeout with setmaxinactiveinterval()
通过编码方式,指定特定的session的过期时间,以秒为单位。例如:
thoughts….
this is a bit confusing , the value in deployment descriptor (web.xml) is in “minute”, but the setmaxinactiveinterval() method is accept the value in “second”. both functions should synchronize it in future release
3、在程序中定义,单位为秒,设置为-1表示永不过期,示例代码为:
希望本文所述对大家的java程序设计有所帮助。
如对本文有疑问, 点击进行留言回复!!
SpringBoot引用阿里easyexcel,Excel导出返回浏览器下载
HashMap、Hashtable、ConcurrentHashMap三者间的异同
解决RecycleView 中Item包含Edittext时,滑动view复用导致数据错乱的问题
多线程、同步工作原理、死锁案例、Lock接口、线程的生命周期的讲解及实现
网友评论