简体   繁体   中英

Contdown on Servlet Session

I need to create a countdown on the servlet´s session to fire events when X minutes to expire...

So, there is a way to know how many seconds is remaining to finish the session?

您可以使用HttpSession API计算剩余时间(以秒为单位):

httpSession.getMaxInactiveInterval() - ((System.currentTimeMillis() - httpSession.getLastAccessedTime())/1000

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM