The method of resolving session timeout jump to landing page and jump out of iframe frame or local area in JSP

Source: Internet
Author: User

When the session timeout occurs, the page request is relocated to the login interface. Most of the use of Ajax dynamic local requests, resulting in the return landing page is nested in the local area of the system interface, not the desired effect. General page main layout using the IFRAME framework for segmentation, or simple practical table and other implementation of the same style effect, in this brief introduction of background page redirection to the landing interface back to the front desk, the front desk to re-direct to the landing interface to achieve the landing interface is flawless.

Add the following to the landing interface JSP polygon:

<%@ page language= "java"  contenttype= "Text/html; charset=utf-8"%><%      string path = request.getcontextpath ();      string  basepath = request.getscheme ()  +  "://"  + request.getservername ()  +   ":"                           + request.getserverport ()  + path +   "/";                         %><script type= "Text/javascript" >     //  page initialization, we use timer processing     //  If you use OnLoad or jquery's $ (document). Read ( function () {...}); may not be able to achieve results. Local conditions         var initscript = setinterval (function () {                 //  case for IFRAME nesting              if  (window.top!=null &&  window.top.document.url!=document. URL) {                 Clearinterval (Initscript);                 window.top.location.href = document. url;     }        //  for table layouts, non-IFRAME scenarios     if (document.getElementById ("You have an element ID in the header area of your page") {         clearinterval (initscript);window.top.location.href =  "<%=basePath%> your Landing Interface relative path";      }        },400);</script>


The method of resolving session timeout jump to landing page and jump out of iframe frame or local area in JSP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.