如何使用JSF/Bean设置和获取HttpSession(@named)

use*_*327 2 session jsf

当使用Servlet/JSP时,我们从HttpServletRequest获取HttpSession,现在我使用JSF/JPA/EJB开发应用程序,我不知道如何在会话中设置属性(准确登录)以及如何获取它们,任何帮助.

Nav*_*dey 8

FacesContext facesContext = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);
session.setAttribute("att", att);
Run Code Online (Sandbox Code Playgroud)