Session Expires when exporting table to exel


I am using “Application.getInstance().getMainWindow().getApplication().close();” method in Window close event to end the session on closing the browser window. I am also exporting tables to excel files in my application. But whenever I click on export , the session expires. When I remove the close() method, the export works properly but my session is left hanging on window close.

Please help

Thank You
Dhaval Maheshwari.


may you provide your code, particularly the part called by the export button and the other one where you attach the window listener ?

Have a nice day.

My window listener is as follows:

main = new Window(“Middleware Application”);
main.addListener(new Window.CloseListener() {
public void windowClose(CloseEvent e) {
String logoutTime = SMUtilityFunctions.currentTime();

and my export button call is as follows:

ExcelExport excelExport = new ExcelExport();
excelExport .export();

Thank You
Dhaval Maheshwari.

may you also provide the part of the code where you create the export button ?
because, I do not see anything wrong in the code that you provided.