JSF Problem with using maxInactiveInterval
Folks, I'm finding that with a test value o开发者_Go百科f 1 minute expiry in web.xml the following code redirects to the given url immediately when the page is rendered:
<meta http-equiv="refresh" content="${pageContext.session.maxInactiveInterval};url=#{facesContext.externalContext.requestContextPath}/index.xhtml"/>
Any pointers would be appreciated.
The ${pageContext}
is only available when you're using JSF on JSP. It seems that you're using JSF on JSP's successor Facelets as you're trying to redirect to a XHTML file. Facelets has totally no notion of a ${pageContext}
. You should be using #{facesContext}
instead. The session is then available by #{facesContext.externalContext.session}
. However, Facelets offers a shorthand to get it: #{session}
. The same for the #{request}
.
So, this should do:
<meta http-equiv="refresh" content="#{session.maxInactiveInterval};url=#{request.contextPath}/index.xhtml"/>
精彩评论