2 Replies Latest reply on Feb 24, 2010 10:28 AM by kirpi4ik

    JSF Phases and Seam component lifecycle

    kirpi4ik

      Hi,


      I have some problem with Seam components, probably I don't have good understanding about Component lifecycle.
      I have the view a_view.xhtml where I'm invoking the method #{beanA.navigateToB}, navigateToB method  returns viewId as String which is mapped in the pages.xml to b_view.xhtml.
      In the b_view.xhtml I have some output #{beanB.showMessage}.


      The use case is more complex, but the idea is the same: a_view.xhtml -> #{beanA.navigateToB} -> b_view.xhtml -> #{beanB.showMessage}


      So the problem is that my beanB(which have CONVERSATION scope) have method @Create which is invoked before #{beanA.navigateToB}.
      It doesn't make sense to me because I whant to make some initializations in the navigation method#{beanA.navigateToB} before the beanB is created.


      Any help is appreciated,




      with beste regards,
      Dima

        • 1. Re: JSF Phases and Seam component lifecycle
          dhinojosa

          If you don't have a reference to beanB in a_view.xhtml, the component is not created until b_view.xhtml is about to be displayed. You can either try:



          1. Use <action> in <page id="a_view.xhtml"> to initialize beanB

          2. Use auto-create in your beanB component

          • 2. Re: JSF Phases and Seam component lifecycle
            kirpi4ik

            Hi Dan,


            It's happens when you are working too much until late hour:)) You are right, I was so sure that the problem is in the Seam lifecycle or JSF Phases, that I didn't realized that in the a._view.xhtml I have small reference to the beanB, so obviously it was instantiated before my navigation method. 


            Thanks.
            with best regards,


            Dima.