I have a JSF2 application.
I have defined a Session bean using CDI.
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
@Named
@SessionScoped
public class UserBean implements Serializable
{
private String userName = null;
private String password = null;
... getters and setters ...
}
Is possible to get the bean from HttpSession? For example, when I try to get it from HttpSession in a servlet class, I get null
HttpSession session = request.getSession(false);
UserBean userBean = (UserBean) session.getAttribute("userBean");
When I have worked with @ManagedBean (instead of CDI) in other applications, I could get it from HttpSession in a servlet class.
Thanks