public String doLogout() { AlterableContext ctx = (AlterableContext) beanManager.getContext(SessionScoped.class); Bean<?> myBean = beanManager.getBeans(AccountBean.class).iterator().next(); ctx.destroy(myBean); myBean = beanManager.getBeans(ShoppingCartBean.class).iterator().next(); ctx.destroy(myBean); return "/main"; }
public String doLogoutAndRemoveCookie() { removeCookie(); user.setUuid(null); em.merge(user); AlterableContext ctx = (AlterableContext) beanManager.getContext(SessionScoped.class); Bean<?> myBean = beanManager.getBeans(AccountBean.class).iterator().next(); ctx.destroy(myBean); myBean = beanManager.getBeans(ShoppingCartBean.class).iterator().next(); ctx.destroy(myBean); return "/main"; }