FAQ
I have page B opened from page A. I insert some data on page B and submit
the form. Then action is performed which generates Word document. After that
it returns to page A. The problem is: how to open page A and then download
automatically generated document? I know how to open page A, I know how to
download generated document, but I do not know how to open page A AND
download document after pressing submit button on page B. I tried many
things and none of them works. Do you have any ideas?

Pawel

Search Discussions

  • Mike Kienenberger at Jun 29, 2005 at 4:14 pm

    On 6/29/05, Kołoszko Paweł wrote:
    I have page B opened from page A. I insert some data on page B and submit
    the form. Then action is performed which generates Word document. After that
    it returns to page A. The problem is: how to open page A and then download
    automatically generated document? I know how to open page A, I know how to
    download generated document, but I do not know how to open page A AND
    download document after pressing submit button on page B. I tried many
    things and none of them works. Do you have any ideas?
    I could be wrong, but aren't you only allowed one response for an html
    request? So you can either return a new page, or you can return a
    document to download (really, just another page), but you can't return
    both at the same time.

    Maybe you could get around it with javascript and the target="_blank"
    link attribute, though.
  • Srikanth Madarapu at Jun 29, 2005 at 4:37 pm
    can you have a form onLoad method run some code and trigger the download ?

    -----Original Message-----
    From: Koloszko Pawel
    Sent: Wednesday, June 29, 2005 12:09 PM
    To: MyFaces Discussion
    Subject: How to open page and download file in one turn?


    I have page B opened from page A. I insert some data on page B and submit the form. Then action is performed which generates Word document. After that it returns to page A. The problem is: how to open page A and then download automatically generated document? I know how to open page A, I know how to download generated document, but I do not know how to open page A AND download document after pressing submit button on page B. I tried many things and none of them works. Do you have any ideas?

    Pawel
  • Slawek at Jun 29, 2005 at 5:01 pm
    page A may (or may not - explain later) have onload attrib=sommeJSfunction.
    that fucntion can open new window: window.open - opened in popup page can
    return to u special header with doc to download.

    when page a should have or not onload attrib:

    <h:outputText value="<body>" escape="false"
    rendered="#{!bean.shouldMakePopup}">
    <h:outputText value="<body onload='openPopUp()'>" escape="false"
    rendered="#{bean.shouldMakePopup}">

    boolean bean.sholdMakePopup can be set when submiting form from B page


    i dont know if i understand twój;) problem Pawel - maybe u mean that page
    B is popup?


    cheers

    Slawek

    I have page B opened from page A. I insert some data on page B and submit
    the form. Then action is performed which generates Word document. After
    that
    it returns to page A. The problem is: how to open page A and then
    download
    automatically generated document? I know how to open page A, I know how
    to
    download generated document, but I do not know how to open page A AND
    download document after pressing submit button on page B. I tried many
    things and none of them works. Do you have any ideas?

    Pawel
  • Csík Norbert at Jul 2, 2005 at 7:21 pm
    Hi!

    I think you should send 2 requests to the server. On the first request
    you generate the response page, and the response file, and send the
    generated page. On the response page You should put some trick (eg. a
    non-visible iframe) to post the second request to download the
    generated file too.
    On 6/29/05, Kołoszko Paweł wrote:

    I have page B opened from page A. I insert some data on page B and submit
    the form. Then action is performed which generates Word document. After that
    it returns to page A. The problem is: how to open page A and then download
    automatically generated document? I know how to open page A, I know how to
    download generated document, but I do not know how to open page A AND
    download document after pressing submit button on page B. I tried many
    things and none of them works. Do you have any ideas?

    Pawel

    --
    Norbert Csík

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriesmyfaces
postedJun 29, '05 at 4:09p
activeJul 2, '05 at 7:21p
posts5
users5
websitemyfaces.apache.org

People

Translate

site design / logo © 2019 Grokbase