I don't need to get the session map in JSF code. JSF does that automatically.
JSF session objects are HTTPSession objects. The only difference between session Managed Beans and bog-standard J2EE session beans is that JSF automatically constructs and initializes them and automatically stores them in the HTTPSession. After that, there's absolutely no way to tell the difference.
Joined: Feb 27, 2010
Thanks Tim Holloway for your reply and your effort ,
I apologize you as I am a very slow learner
but the question is that How I can access the session value from servlet ? I have tried below code but it fails.
I removed the ActionEvent parameter because I strongly discourage frivolous use of Listeners. Use a simple POJO action method instead.
You don't need a constructor for userBean because it's a Managed Bean and JSF will construct the UserBean instance for you and store it as a session object in accordance with the faces-config directives supplied.
You don't need FacesContext or the getSessionMap.put operation to store the UserBean as a session object because JSF did that already as part of the process of creating the managed bean, as mentioned above.
All you need to do is use the bean itself. Everything else was done for you automatically by JSF. It's what JSF is all about. Simplification.
Here's the faces-config info that goes with all of the above: