JSF会话不保留域会话

时间:2019-02-13 08:38:45

标签: tomcat web jsf session-cookies

我创建了一个JSF小型应用程序,其中存在一个index.xhtml(设置为欢迎文件),其中包含登录表单,以及一个home.xhtml页面,该页面将从模板呈现内容。问题是登录完成后,会话 仅当在url中指定了这些文件时才起作用,例如“ http://localhost/index.html”,但是如果我键入“ http://localhost”,它将再次显示登录表单,并且如果我输入页面名称,则显示内容登录的用户。在域上看不到该会话。 登录bean定义为:

 @ManagedBean
 @SessionScoped
 public class Login implements Serializable

还有一个过滤器:

 if(reqURI.indexOf("/index.xhtml") >= 0
            || (ses != null && ses.getAttribute("username") != null)
            || reqURI.indexOf("/public/") >= 0
            || reqURI.contains("javax.faces.resource"))
            chain.doFilter(request, response);
        else
            resp.sendRedirect(reqt.getContextPath() + "/index.xhtml");
        if(reqURI.indexOf("/index.xhtml") >= 0 && (ses != null && ses.getAttribute("username") != null))
            resp.sendRedirect(reqt.getContextPath() + "/home.xhtml");

为什么在http://localhost/上看不到该会话?该如何解决?

0 个答案:

没有答案