Window close issues in gwt -ext

半腔热情 提交于 2019-12-13 21:12:57

问题


Hello all I am using gwt-ext in my application.In that application session time is 5 minutes. My issues is that If any window is open to render some information & in between session goes out then user logged out but the opened window is not closing in that case.

So just want to know that how close opened window while session is timed out and user is logged out.

Thanks in advance.


回答1:


You can follow these steps to close tour any open window at sesssion time out:

  1. Whenever you make an Object of Window: assign an Id to that Window.

    window.setId("myWindow");
    
  2. The place at which you're handling session time out, place this code:

    ExtElement extElement = Ext.get("myWindow");
    if (extElement != null && Ext.getCmp(extElement) != null
        && Ext.getCmp(extElement) instanceof Window) {
        Window window = (Window) Ext.getCmp(extElement);
        window.close();
    }
    



回答2:


There is a class called Timer in GWT in which we can fire a request to the server at a regular interval of time.So that you can check on the server side for the session and when session is invalid you can reload the application to login page or nay othet page using Window.Location.reload();



来源:https://stackoverflow.com/questions/5831439/window-close-issues-in-gwt-ext

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!