3 Replies Latest reply on Jun 8, 2009 1:46 PM by lvdberg

    how to call one moethod after another

    ashutoshdeora

      i have methods  




      Code:
      METHOD A(){
      QUERY 1 -  it will fetch small amount of data - i put this data in rich:datatable (TABLE  1) 
       }



           





      Code:
      METHOD B(){
      QUERY 2 - it will fetch huge amount of data (it will take some time to do it) 
       i will put this data also in rich:datatable (TABLE  1) 
      }     
      





      i have only one click to perform this
      condition:- i can click only once
      i have to complete method A then only i can execute METHOD B
      i cannot call method B in Method A


      now any budy can give me any idea for this
      session bean is the class from where the methods will be invoked and it will fill the data in a datatable

        • 1. Re: how to call one moethod after another
          jimk1723

          It feels like there are some requirements missing here. Do you need the call to B() to not block since you're expecting it to take a while?


          If not, could the solution be as simple as:


          Method C(){
          A();
          B();
          }
          



          Other methods off the top of my head, using RichFaces...



          • Add a a4j:jsFunction call to B() that updates the rich:datatable

          • Have your a4j:commandButton call A() and reRender the rich:datatable

          • In the onComplete for the commandButton, call the jsFunction.



          Using a synchronous events,



          • Call A() in the same manner as above

          • Kick off a a4j:poll onclick, have it update the datatable

          • Have A() raise an asynchronous event

          • Have B() handle the event and update the model for the rich:datatable


          • 2. Re: how to call one moethod after another
            ashutoshdeora

            thanks for the suggestion
            i am using same kind of concept that you have suggested




            • 3. Re: how to call one moethod after another
              lvdberg


              You could do this by defining the different actions before the navigation riles in youe X.page.xml file.