5

When using Servlet/JSP, we get HttpSession from HttpServletRequest, now that I develop an application using JSF/JPA/EJB, I don't know how to set attribute in session (for login exactly) and how to get them, any help.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user3923327
  • 137
  • 1
  • 4
  • 11

1 Answers1

12
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);
session.setAttribute("att", att);
NavinRaj Pandey
  • 1,674
  • 2
  • 26
  • 40