2 Replies Latest reply on Nov 21, 2008 7:08 AM by dcflex

    Do you use Java Faces with Flex?

    dcflex
      I'm having problem getting the FacesContext because the faces serlvet does not process the mesages passed from Flex component.
        • 1. Re: Do you use Java Faces with Flex?
          SujitG Level 2
          Hi,

          How is the flow working? How are you invoking your JSF pages from Flex? are you using HTTPService component to send the request?
          • 2. Do you use Java Faces with Flex?
            dcflex Level 1
            I created jsp pages and embeded Flex application within these pages. I do use HTTPService to pass the data between the Flex components and the back bean.
            I ran into two major problems though. I couldn't get FacesContext consistantly meaning that I got null when the servlet tries to call FacesContext.getCurrentInstance() or
            FacesContextFactory contextFactory =
            (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
            LifecycleFactory lifecycleFactory =
            (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
            Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
            facesContext = contextFactory.getFacesContext(
            this.getServletContext(), request, response, lifecycle);

            I may have solved this problem by getting the bean directly from the HttpServletRequest. But if the back bean tries to use other faces context such as ExternalContext, then it gets null.

            The second problem I ran into is that I can't to create two instances of the same Flex application. I try to use SWFObject to create two instances of the same Flex application in two different jfp pages. The initial HTTPService is not called for the second page. It appears that the application re-uses the same data for the second page. I asked this question in this Forum before but I didn't get any answer.