Thursday, 30 August 2007

JSF Basics Access the HTTP Session from a backing bean

Here is something I always seem to forget and never realy got to use :-)
Code to gain access to the HTTP session from a inside backing bean :

FacesContext fc = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest)fc.getExternalContext().getRequest();
HttpSession session = request.getSession();

No comments:

Post a Comment

I have had so many good people trying to promote various community oriented sites through here. Therefore all comments will first have to come through me... so I get a chance to learn about the interesting sites before you do ...