| | |
Close Pop up window when cancel on dialog box is pressed
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Hello
I have a jsp on which there is a table and a hyperlink to Export the same table into excel sheet. According to the functionality, it is required that on clicking Export, a blank pop up without address bar and other toolbars will be opened and on that empty pop up, the dialog box for Open, Save or Cancel Excel file will come.
Now, if the user clicks on open, the excel file opens in the pop up. But if user clicks on either save or cancel, in the both cases, the blank pop up remains opened. Please suggest the ways to close it automatically when save or cancel is clicked.
Thanks
I have a jsp on which there is a table and a hyperlink to Export the same table into excel sheet. According to the functionality, it is required that on clicking Export, a blank pop up without address bar and other toolbars will be opened and on that empty pop up, the dialog box for Open, Save or Cancel Excel file will come.
Now, if the user clicks on open, the excel file opens in the pop up. But if user clicks on either save or cancel, in the both cases, the blank pop up remains opened. Please suggest the ways to close it automatically when save or cancel is clicked.
Thanks
Try combining dispose() or exit() with the window...you could also pass a variable false to set the pop-ups visibility.
What is your code? You could also set your pop-up as listener for an close event. Did you try that one too?
What is your code? You could also set your pop-up as listener for an close event. Did you try that one too?
Last edited by loken; Jul 17th, 2008 at 5:02 am. Reason: additional information
Crash dump, something worse than dying...
•
•
•
•
Try combining dispose() or exit() with the window...you could also pass a variable false to set the pop-ups visibility.
What is your code? You could also set your pop-up as listener for an close event. Did you try that one too?
If the user clicks on Open, then only the jsp will be loaded in the excel format on that pop up, else in case of Save and Cancel, the pop up will remain without Body. That is why I could not provide any code for that.
I want to know, can something be done in the opener of that pop up?
Same problem was present in Google Analytics, but here on clicking on Export, a new Browser window is opened, not any pop up.
Thanks
•
•
•
•
similarly you can call the dispose() or flush() or even setVisible(false) method on the click event for the cancel button. that way the popup should close.
Let me explain. Assume X.jsp is a page on which a link Export is present. On clickicking it, a new Pop up is opened which DOES NOT have any body. A new page called Y.jsp will be loaded on this pop up in Excel Format. In Y.jsp I am using contentType="application/vnd.ms-excel; charset=UTF-8" in Y.jsp, that is why I cannot place any javascript code on Y.jsp.
I have attached the view of Dialog Box. If Open is pressed, Y.jsp will be loaded on EMPTY pop up, else, the pop up will be there without any body.
ok, seems I must have misunderstood you...sorry about that...
this is how I would normally handle closing..
method onCancel
{
this.setVsible(false);
this.dispose();
}
I haven't check it with this sort of pop-ups so I might have to check more about this...I'll update you with my output...
this is how I would normally handle closing..
method onCancel
{
this.setVsible(false);
this.dispose();
}
I haven't check it with this sort of pop-ups so I might have to check more about this...I'll update you with my output...
Crash dump, something worse than dying...
•
•
•
•
ok, seems I must have misunderstood you...sorry about that...
this is how I would normally handle closing..
method onCancel
{
this.setVsible(false);
this.dispose();
}
I haven't check it with this sort of pop-ups so I might have to check more about this...I'll update you with my output...
- Do have to place this code snippet in the JSP which will be loaded as excel file?
- Does this onCancel function needs any input parameters? Because how onCancel() will know that Cancel or Save is pressed?
- Javascript function in an excel file... Believe me.... I am surprised.
![]() |
Other Threads in the Java Forum
- Previous Thread: i need urgent help. this error cmoing. i dont know what to do
- Next Thread: JDBC, MySQL
| Thread Tools | Search this Thread |
2dgraphics account android api apple applet application array arrays automation banking binary binarytree bluetooth chat chatprogramusingobjects class classes client code component data database derby design draw eclipse encryption error event exception fractal game givemetehcodez graphics gui html ide if_statement image inheritance input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel jtextfield julia linux list loop map method methods midlethttpconnection mobile monitoring netbeans newbie nullpointerexception open-source oracle print printing problem program programming project property recursion reference ria scanner screen search server set size sms sort sourcelabs splash sql static stop string swing testautomation threads time tree ui unicode validation windows





