1 Reply Latest reply on Dec 2, 2010 2:35 PM by alexsmirnov

    Unable to get FacesContext

    nandhana03

      I've written a class which extends GenericFacesPortlet.  I'm unable to get  FacesContext .  On giving FacesContext.getCurrentInstance(), itz returning null.   I'm using  portletbridge-api-2.0.0.FINAL.jar  &  portletbridge-impl-2.0.0.FINAL.jar.   My JSF version is JSF 1.2. 

       

      My web.xml configuration :

       

         <servlet> 
              <servlet-name>FacesServlet</servlet-name>
              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
              <load-on-startup>1</load-on-startup>
          </servlet>

       

          <servlet-mapping>
            <servlet-name>FacesServlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
          </servlet-mapping> 
        
          <servlet-mapping>
              <servlet-name>FacesServlet</servlet-name>
              <url-pattern>*.jsf</url-pattern>
          </servlet-mapping>

       

      Is there any additional configuration which I need to do ????????

      Anybody plz help me rectify this...thnx in advance....

        • 1. Re: Unable to get FacesContext
          alexsmirnov

          GenericFacesPortlet calls javax.portlet.faces.Bridge implementation that actually performs the same actions as FacesServlet ( it creates and destroys FacesContext, and executes JSF Lifecycle ). GenericFacesPortlet only creates bridge instance ( based on configuration ) and initializes it.

          Therefore, FacesContext is not available from Portlet methods, it just not created yet.