JSP Response.getMaxInactiveInterval()方法:获取session的有效时间

  • 内容
  • 评论
  • 相关

该方法用于获取 session 的有效时间,负值表示 session 永远不会超时,它的值为该 session 对象的生存时间。

语法:

getMaxInactiveInterval()

返回值:session 的有效时间,单位是秒。

示例

在页面中输出 session 的有效时间,关键代码如下:

<%
  long timeNum = session.getMaxInactiveInterval();
  out.println("这个session的有效时间是:"+timeNum);
%>

本文标题:JSP Response.getMaxInactiveInterval()方法:获取session的有效时间

本文地址:https://www.hosteonscn.com/6326.html

评论

0条评论

发表评论

邮箱地址不会被公开。 必填项已用*标注