• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

File Saving Window

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have a window shows a list of files and when one of them is selected and a 'Save' button is clicked, it opens a new window which saves the file selected in the previous window. The jsp code for second window is as below



My question is, how can I close the second window when I am done with saving the file? I tried <script> window.close(); </script> which did not open a file save popup and closed immediately.

Any help is appreciated.

Thanks,
Kiran
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can set the onclose even in a saeTimeout to delay the time it closes, you can have the jsp page write out the close tag after the upload is complete, You can put upload complete in the page with a close button.

Eric
 
Kiran Kumar
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.

I am not sure if I put it in a correct way.

On page 1, I select a radio button (representing a txt file) and hit a button. Then a new page (page 2) opens along with a small popup box prompting the user to select the folder he can save the file to (General 'open', 'save', 'cancel'..buttons on this popup). I then select a folder and click on 'save' which saves the file and closes the small popup, but the page 2 still remains without closing. How do I close the page 2?

I hope I put it more precisely this time.
Regards,
Kiran
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can not picture what you are talking about in my head right now, but I will try to figure it out.

Are you saying that the pop up is closing and you want the window that opened it close too?

if that is the case, add onunload=window.opener.close()" to the pop up window.


Eric
 
Kiran Kumar
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have understood me right.

Anyway, here are the windows
1. Original window (page1)
2. Page 2 (this was opened when a button on page 1 was clicked)
3. A file save dialog popup (Automatically opens up because of response.setContentType("application/octet-stream"); )

Now, after I save the file(by clicking 'save' on popup), page 2 still remains open. I cannot do onunload=window.opener.close() because that closes page 1. The problem here is, I have no control over the file saver dialog box.

Thanks,
Kiran
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic