I need to get a reference to a the Session to read a value in a user variable.
In jsf I use:
(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
Works well, but when the url is not jsf, it doesn't work. There is some way to get a reference to the session in a bean? I'm calling this bean from AJAX code.
On 2/22/06, Craig McClanahan <[EMAIL PROTECTED]> wrote:
On 2/22/06, Vladimir Coutinho < [EMAIL PROTECTED]> wrote:Could I access faces context from a non jsf class? (a bean used with AJAX)
FacesContext fc = FacesContext.getCurrentInstance();
You can do this from any class ... but it will only return a useful result in the context of a request that is actually being handled by JavaServer Faces (i.e. one whose URL matches the URL mapping for FacesServlet) -- or if you are following the outline in the spec for turning a non-Faces Request into a Faces Response.
--
Vladimir M Coutinho
Craig
--
Vladimir M Coutinho

