2 Replies Latest reply on Jul 1, 2010 10:40 AM by Fabio Montezuma

    howto click download button and keep page context?

    Fabio Montezuma Newbie

      Hello,


      I have the following situation:


      At main page I click at one button and it opens a form modalPanel. I have a page context bean controlling which modalPanels should be rendered.


      I fill the form and click a4j:commandButton.
      The action do some filtering on my database and finally redirect to an excel template page.


      OK! I can download the excel file and everything seems to be the way I wanted.
      But if I try to submit the form again I can see that I lost my page scoped bean, so the modalPanel just close instead of redoing the job described above.


      I already have a solution for this (which is asking to the new ModalPanelController to open the already opened modalPanel on the oncomplete event of the commandButton), but I would like to know if there is anyway to keep the page context after clicking on a download button.


      Sorry for the long text.
      Thanks in advance.

        • 1. Re: howto click download button and keep page context?
          Sean Tozer Newbie

          I think you may be misunderstanding the use of PAGE scope:


               The page context. Begins during the invoke application
               phase prior to rendering a page, and lasts until the end 
               of any invoke application phase of a faces request 
               originating from that page. Non-faces requests do not
               propagate the page scope.
          


             
          If you go to request any other page (redirect to an excel template page), the previous page context is lost.


          It sounds like what you want is a long-running conversation context, instead.

          • 2. Re: howto click download button and keep page context?
            Fabio Montezuma Newbie

            Actually I do understand the problem here, but what I want is to download the generated excel file without losing the page context. Is it possible?


            I tried a different approach using long-running conversation between two browser windows.
            I was starting a conversation as soon as I could see that the generated file was ok.
            On the oncomplete of the action button I opened a browser window that was pointing to the excel template passing the actual conversation id.
            In the .page.xml of this excel template I was ending the conversation.
            But after ending this conversation when I tried to do something in the main page the browser was refreshing and starting a new conversation, losing the page context too.


            Tried to use nested conversation too. But got no success. I'm not sure I did it right in this case, but the same thing happened.