javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-1717

FacesContext.getCurrentInstance() returns null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.2_04
    • Fix Version/s: None
    • Component/s: lifecycle
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      1,717
    • Status Whiteboard:
      Hide

      size_medium importance_small

      Show
      size_medium importance_small

      Description

      >>> java code
      public class MyListener extends ConfigureListener{
      public void contextInitialized(ServletContextEvent event)

      { super.contextInitialized(event); FacesContext context = FacesContext.getCurrentInstance(); }

      }

      >>> web.xml
      ...
      <listener-class>
      com.test.MyListener
      </listener-class>
      ...

      The value of context is null.

      Although the default implementation is called through super.xxx() the context
      is not ready yet. I tried to search for this problem but could not find any
      info.

        Activity

        Hide
        Ed Burns added a comment -

        Bulk assign all impl issues to Roger.

        Show
        Ed Burns added a comment - Bulk assign all impl issues to Roger.
        Hide
        Manfred Riem added a comment -

        The FacesContext.getCurrentInstance is only guaranteed to be available within the scope of LifeCycle. Since you are calling the method outside of a LifeCycle there is no HTTP request and response that the FacesContext is associated with. As such that method is not available for usage.

        Show
        Manfred Riem added a comment - The FacesContext.getCurrentInstance is only guaranteed to be available within the scope of LifeCycle. Since you are calling the method outside of a LifeCycle there is no HTTP request and response that the FacesContext is associated with. As such that method is not available for usage.

          People

          • Assignee:
            rogerk
            Reporter:
            pradeepk188
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: