This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Close popup after generating a file

 
Julio Ayala
Greenhorn
Posts: 15
Eclipse IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I need to close a popup window after generating a file. The content of the file comes from another application. The popup should be closed after the file is printed, when the streams are closed, but I cannot write anything else in this page because the response has been already commited. Could you give me any ideas?

The process is a little bit confusing, and we are forced to used the other application... I will try to explain the steps clearly:

1. I create the popup where my servlet is going to be executed.
2. The servlet changes the headers and compose the url to call the other application.
3. The servlet reads the results and close the streams. The browser shows the download window.
4. Now the popup is no longer necessary and should be closed, but I can't write in the same page because the response has already been commited.

Any ideas or advices will be appreciated. We are using java5.

Here you have the servlet code:



Thank you in advance
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use an AJAX check form the main window to poll for when the download is complete? I'm not clear on why you want to close the child window though. Doesn't it potentially contain a file (depending on user settings.)
 
Julio Ayala
Greenhorn
Posts: 15
Eclipse IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Jeanne,

After saving the file, the popup window is still there, it appears when line 26 is executed. The popup doesn't contain anything. In fact I don't want this window, but I need it to call the servlet and generate the file without changing the main page.

Sorry, but I didn't get the point about the ajax check form, could you give another keyword or something to look for? How could I know the user has executed an action (save, open or cancel)?Or how could I know from the main page that the file has been generated? When the file is generated I can't do forward to another page (the response has been commited) and I don't see the way to include javascript in the popup because everything that I print will be included in the file... Please let me know if you need more details.

Thank you for answering so quickly!

 
Julio Ayala
Greenhorn
Posts: 15
Eclipse IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well...this is not a form, but maybe you were suggesting something like this in the parent window(not with closed, but another event):



The problem is that while the popup is still generating the file, the user could visit another page since de parent window, and this code would never be executed.

Any help will be much appreciated, thank you in advance.
 
Julio Ayala
Greenhorn
Posts: 15
Eclipse IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry about this, I forgot it. I have already fixed it.

Actually I'm thinking about using iframes, one for printing the file and another one for closing the popup.

 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic