They are in different layers of the application. A HttpSession is used in the front end/web layer of an application to keep track of data specific to a user. An EJB Session bean is used in the back end/EJB layer. There are two types of session beans. A stateful session bean can also keep track of data specific to a user. A stateless session bean cannot keep track of state.