session到期情況下快顯視窗顯示2個登陸頁面的問題處理

來源:互聯網
上載者:User

標籤:style   blog   java   color   使用   資料   

 

根據多年的web開發經驗,一般當session到期之後,當使用者點擊任何一個按鈕之類的,都是自動跳轉到登陸頁面,這個在網上有很多過濾器,攔截器實現。

那麼在使用類似jquery easy ui的時候,如果頁面有一些快顯視窗,是在彈出了視窗再去載入地址拉資料出來的,就會出現父頁面跳到登陸頁面,彈出頁面也跳到登陸頁面。

如何解決這個問題呢,我的辦法如下:

 

首先,在過濾器中如果是session到期的話,自動跳到登陸頁面,並且帶上一個固定參數,在頁面index.jsp中擷取這個參數,如果存在。

其實就是在這個頁面中手動關閉彈出的頁面,只保留父頁面的location跳轉。

<%    String timeout =request.getParameter("timeout");    if(timeout!=null){    %>    <script type="text/javascript">        if(window != top){//當這個視窗出現在iframe裡,表示其目前已經timeout,需要把外面的架構視窗也重新導向登入頁面        top.location.href = ‘<%=request.getContextPath()%>/index.jsp‘;        //關閉快顯視窗        window.close();        window.opener.document.location.reload();    }else{        top.location.href =‘<%=request.getContextPath()%>/index.jsp‘;        //關閉快顯視窗        window.close();        window.opener.document.location.reload();    }    </script>    <%    }else{            }    %>
                                                                                                      

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.