2 Replies Latest reply on Jun 4, 2013 2:30 PM by Cory Dahlstrom

    Seam 2.3 + a4j:ajax + pages.xml

    Cory Dahlstrom Novice

      We are upgrading to Seam 2.3 from Seam 2.1 and have a question.


      In our pages.xml file for our pages, most all of our pages are defined in the example below where we call an "init" method on the action associated with the page to initialize data needed by the page.


      <page view-id="/somepage.xhtml" login-required="true">

              <begin-conversation join="true" flush-mode="manual" />

              <action execute="#{somePageAction.init}" />



      With this, we use a lot of ajax which was provided by the a4j:support tag.  This has now changed to a4j:ajax ( with the upgrade to Richfaces 4 with Seam 2.3 ) and behaves mostly similar.


      One difference that I'm having issues with is with pages.xml.  With Seam 2.1, when an ajax call is made to a method via the a4j:support tag, and the method returned null, the "somePageAction.init" method

      was not called at the end of the ajax call.


      Now with the newer version, at the end of each ajax call, the "init" method is being called.  It's like the ajax call is going through pages.xml in some way.


      Does anyone know why this is the case?





        • 1. Re: Seam 2.3 + a4j:ajax + pages.xml
          Immo Benjes Newbie

          If I understand you correctly you only want it called when the page is loaded for the first time but not on every ajax request, correct?


          In this case you use





          <action execute="#{somePageAction.init}" on-postback="false" />



          But that was already introduced a while back. Back in Seam 2.0 you had to do somthing like



          if="not facesContext.renderKit.responseStateManager.isPostback(facesContext)


          • 2. Re: Seam 2.3 + a4j:ajax + pages.xml
            Cory Dahlstrom Novice

            Thanks for the response.  Yes, this is exactly what I was referring to.


            Yea, this is weird because our current app in production is based on Seam 2.1.1 GA and the "init" method doesn't get called on any of our <a4j:... Ajax requests.