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

Method 1: Redirect to the login page, but do not support jumping out of the IFRAME
Response.sendredirect ("/dormitory/tologinpage");
Method 2: Jump to the login page in the output page and request to the login page, you can jump out of the IFRAME (recommended)
PrintWriter out = Response.getwriter ();
Out.println ("
Out.println ("<script>");
Out.println ("window.open ('/dormitory/tologinpage ', ' _top ')");
Out.println ("</script>");
Out.println ("
return false;

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.

<script type= "Text/javascript" >
var initscript = setinterval (function () {
if (window.top! = null && window.top.document.url!=document. URL) {
Clearinterval (Initscript);
Window.top.location.href = document. URL;
}
});
</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.