Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set and get HttpSession using JSF/Bean (@named) [duplicate]

Tags:

session

jsf

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.

like image 855
user3923327 Avatar asked Sep 20 '14 17:09

user3923327


1 Answers

FacesContext facesContext = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);
session.setAttribute("att", att);
like image 132
NavinRaj Pandey Avatar answered Jan 04 '23 12:01

NavinRaj Pandey