winscp怎么做网站,价格网官网,企业网站建设需要哪些资料信息,经典软文推广案例我一直在看这个话题的很多帖子,但是无法得到一个适用于我的例子的解决方案.我正在使用Java EE 6与JSF 2.0(部署在JBoss AS 7.1上)在我的web.xml中,我有#xff1a;1我希望用户在会话自动超时时被重定向到登录页面.我试过了方法1#xff1a;使用过滤器我尝试了以下过滤器…我一直在看这个话题的很多帖子,但是无法得到一个适用于我的例子的解决方案.我正在使用Java EE 6与JSF 2.0(部署在JBoss AS 7.1上)在我的web.xml中,我有1我希望用户在会话自动超时时被重定向到登录页面.我试过了方法1使用过滤器我尝试了以下过滤器WebFilter()public class TimeOutFilter implements Filter {Overridepublic void init(FilterConfig filterConfig) throws ServletException {}Overridepublic void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,ServletException {System.out.println(filter called);final HttpServletRequest req (HttpServletRequest) request;final HttpSession session req.getSession(false);if (session ! null !session.isNew()) {chain.doFilter(request, response);} else {System.out.println(Has timed out);req.getRequestDispatcher(/logon.xthml).forward(request, response);}}Overridepublic void destroy() {}}在web.xml我尝试过TimeOutFilter*.xhtml和TimeOutFilterFaces Servlet过滤器的工作原理是每个请求(在控制台中记录“fiter called”).但是当会话超时时,它不会被调用.方法2HttpSessionLister我试图使用一个HttpSessionListerner.该方法称为具有以下签名public void sessionDestroyed(HttpSessionEvent se) {}我无法重定向到特定页面.当我想重定向用户时,我通常使用FacesContext中的NavigationHandler,但在这种情况下,没有FacesContext(FacesContext.getCurrentInstance()返回null).根据这个post,HttpListener不能重定向用户,因为它不是请求的一部分.题解决这个问题最好的方法是什么我可以做些什么来做上述两种上述方法之一