Java 在JSP页面中获取maxInactiveInterval值
我试图在会话超时时刷新页面。我正在将此添加到HTML的Java 在JSP页面中获取maxInactiveInterval值,java,jsp,el,Java,Jsp,El,我试图在会话超时时刷新页面。我正在将此添加到HTML的部分: <meta http-equiv="refresh" content="${sessionScope['maxInactiveInterval']};url=${pageContext.servletContext.contextPath}/index.htm?reason=expired"/> 但是,这:${sessionScope['maxInactiveInterval']}或${sessionSc
部分:
<meta http-equiv="refresh"
content="${sessionScope['maxInactiveInterval']};url=${pageContext.servletContext.contextPath}/index.htm?reason=expired"/>
但是,这:${sessionScope['maxInactiveInterval']}
或${sessionScope.maxInactiveInterval}
打印空值(无)
我知道在JSF中我可以使用:
#{session.maxInactiveInterval}
,它可以工作。如何在JSP页面中实现这一点?下面的行将为您提供maxInactiveInterval
${pageContext.session.maxInactiveInterval}
因为sessionScope
只将会话范围内的变量名映射到它们的值,
其中aspageContext.session
为客户端提供会话对象
您可以在中找到它。您是否尝试过使用
sessionScope.maxInactiveInterval
?是的。我在我的问题中提到了这一点。有点忘记了pageContext对象。向上投票,因为它提醒了我你提到的事实:)