Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 2 无法在Glassfish 3.1中注销工作_Jsf 2_Glassfish 3_Jdbcrealm - Fatal编程技术网

Jsf 2 无法在Glassfish 3.1中注销工作

Jsf 2 无法在Glassfish 3.1中注销工作,jsf-2,glassfish-3,jdbcrealm,Jsf 2,Glassfish 3,Jdbcrealm,我已经尽了一切可能。在玻璃鱼中禁用SSO。将session.invalidate放入jsp页面并重定向。在jsf支持bean中执行request.invalidate。我该怎么办?谢谢 编辑 这很有效 private String email; public ViewLines() { } @PostConstruct public void onLoad() { Principal principal = FacesContext.getCurrentInstance(

我已经尽了一切可能。在玻璃鱼中禁用SSO。将session.invalidate放入jsp页面并重定向。在jsf支持bean中执行request.invalidate。我该怎么办?谢谢

编辑

这很有效

   private String email;

public ViewLines() {


}

@PostConstruct
public void onLoad() {

    Principal principal = FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal();
    email = principal.getName();

    if (email != null) {
        User user = userService.findUserbyEmail(email);

        for (Acl acl : user.getAclList()) {

            if (acl.getAccess().equals("allow")) {
                digPackageLines(acl.getTreeId());
            }
        }
    } else {
        FacesUtils.addFatalMessage("Couldn't find user information from login!");
    }
}  


 @WebServlet(value = "/j_security_logout")
public class LogoutServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        request.getSession().invalidate();
        response.sendRedirect("index.jsf");
    }
}

你到底是如何得出这样的结论的?你不是在使用浏览器后退按钮和/或从浏览器缓存中查看页面吗?嘿,巴卢斯。我能让它工作。我忘了更新这个线程。我认为问题在于我作为会话bean的私有成员访问会话bean中的主体。我将主体调用更改为用@PostConstruct装饰的构造函数,它开始正常工作。我已经更新了原来的帖子来展示我所说的内容。我还将注销改为servlet,这似乎很有效。尽管我用jsf动作方法做了基本相同的事情。