1 Reply Latest reply on Dec 9, 2010 4:22 AM by Kerdudou Ronan

    keepalive only after restore view

    Kerdudou Ronan Apprentice

      hi all,

      I would like to use keepalive in the same page and with the same bean as the t:aliasbean from tomahawk.
      Something like

      ...
      <a4j:keepAlive beanName="mybean" />
      ...
      <t:aliasBean alias="#{aBean}" value="#{mybean}">
      ...
      

      I have bugs because the aliasbean tag evaluate its #{mybean} EL before ajax4jsf set mybean back.
      Looking closer at the code, I saw that the keepalive tag put mybean in the attributes list of the viewRoot and it's only after the restore view that the bean is taken from viewroot's attributes and restored.
      Unfortunatly for me, the aliasbean tag evaluate its EL during the restore view phase and then don't find the right myBean instance.

      Is there a way to improve keepalive feature to make bean available during the restore view phase ?
      Is there at least some lead to workaround ?
      (don't say facelet or seam... I know ....but it's too late for us :))

      Thanks for all reply.


        • 1. Re: keepalive only after restore view
          Kerdudou Ronan Apprentice

          Román W. contacted me through Facebook and said :

           

          « Hi Ronan, I'm Román, from Argentina. Sorry for contacting you via this mean, I couldn't find your email in the web. I've seen a post added by you in the jboss community forum: http://community.jboss.org/message/20806
          I also need to have a keep-alived bean for restore view phase. Have you   find any solutions for that? If yes, could you please give me a hand   with this? Thanks in advance!! (And sorry if I made mistakes in this  message, my English is in version  beta.) Román. »

           

          Hi Roman,

           

          I think my e-mail is in my Jboss Comunity profile, and if the question is about this post, you just have to reply to it and i receive a notification.

           

          The solution we found was to code our own keepalive component, but i won't be able to give you all the details of its implementation.

           

          we made a KeepAliveManager that handle two kind of keepalive : 'view' and 'session'...

          inside the KeepAliveComponent restoreState() we restore the kept-alive object from the view // in saveState() we store in the view.

          we use a PhaseListener and during beforePhase PhaseId.RESTORE_VIEW we restore the kept-alive object from the session.

          inside our class we can call keepAlive into session (generally when we know that we'll navigate to a page with a 'redirect').

           

          good luck for your dev,

           

          note : I think there's no longer any problem with that in JSF 2.0, but I can't be sure as i haven't migrated yet.

           

          Ronan.