3 Replies Latest reply on Jul 16, 2008 9:14 AM by ilya_shaikovsky

    how keep alive works?

    simoncigoj

      I would like to know some more detail of houw a4j:keepalive works? How are the data kept between requests? Is it some sort of session? Does it use more memory? How would this component afect the memory usage of the server on multiuser webapps with many simultaneous users?

      I would appreciate very much some more info about that.

        • 1. Re: how keep alive works?
          ronanker

          A4j:keepalive stores your backing bean in the view object.
          Thus, the bean is saved with the view in the session.

          After the view is restored, the bean is set back in the request scope.

          In a memory usage point of view, it's better to use "request scope" bean than "session scope" bean.
          The keepalive tag is more flexible way to use "request scope" bean.

          But there is two issues with keepalive tag :
          - It does not work with "redirect".
          - The saved bean is not available during the first phase (restore view)

          • 2. Re: how keep alive works?
            simoncigoj

            I mainly use request beans.

            You mantioned two isues, how can those isues represent a real problem?

            What did you mean with redirect? I use keepAlive only for storing the bean value during ajax requests on the sam page, I dont nead the bean anymore if I redirect the aplication on some other page.

            I also didn't undestand the second issue, In which cases would I nead the bean in the restore view Phase.

            I'm quite new to JSF and I dont jet realy understand the whole JSF lifecycle magic.

            • 3. Re: how keep alive works?
              ilya_shaikovsky

              about redirect. No, you can freely use JSF navigation and the bean will be stored.

              But the navigation case should not be redirect one. Because in this case view created from scratch (as for first time page visit) and objects stored in view lost.