伙计们,我发现在web.xml中测试值为1分钟到期时,以下代码会在呈现页面时立即重定向到给定的URL:
<meta http-equiv="refresh" content="${pageContext.session.maxInactiveInterval};url=#{facesContext.externalContext.requestContextPath}/index.xhtml"/>
任何指针都会受到赞赏。
答案 0 :(得分:7)
只有在JSP上使用JSF时才能使用${pageContext}
。当您尝试重定向到XHTML文件时,似乎您在JSP的后继Facelets上使用JSF。 Facelets完全没有${pageContext}
的概念。您应该使用#{facesContext}
代替。然后,#{facesContext.externalContext.session}
可以使用该会话。但是,Facelets提供了获取它的简写:#{session}
。 #{request}
也是如此。
所以,这应该做:
<meta http-equiv="refresh" content="#{session.maxInactiveInterval};url=#{request.contextPath}/index.xhtml"/>