在JSP页面中获取maxInactiveInterval值

use*_*247 3 java jsp el

我正在尝试在会话有timedout时刷新页面.我将此添加到我<head>的HTML部分:

<meta http-equiv="refresh"
      content="${sessionScope['maxInactiveInterval']};url=${pageContext.servletContext.contextPath}/index.htm?reason=expired"/>
Run Code Online (Sandbox Code Playgroud)

不过这样:${sessionScope['maxInactiveInterval']}${sessionScope.maxInactiveInterval}打印出空值(无).

我知道在JSF中我可以使用:#{session.maxInactiveInterval}它可以工作.如何在JSP页面中进行此操作?

小智 7

下面的线将给你 maxInactiveInterval

${pageContext.session.maxInactiveInterval}
Run Code Online (Sandbox Code Playgroud)

因为sessionScope只将会话范围的变量名称映射到它们的值,其中Where为pageContext.session客户端提供会话对象

您可以在官方文档中找到它.