2 Replies Latest reply on Jan 22, 2008 5:51 AM by João Bosco Monteiro

    FacesContext is null at Session startup???

    Monkey Den Master

      I have the following JavaBean which starts up with the session:

      @Startup
      @Scope(SESSION)
      @Name("userSession")
      public class UserSession implements Serializable {
      ...
      
       @Create
       public void create(){
       FacesContext ctx = FacesContext.getCurrentInstance();
       ExternalContext ext = ctx.getExternalContext();
       HttpServletRequest req = (HttpServletRequest)ext.getRequest();
       }
      ...
      }


      I have thought through the request lifecycle and can't see a reason why FacesContext would be null at this stage, but it is.

      Ideally, I'd like to log the user in here if they have Remember Me turned on.