With frameset, after session and timeout, you can click any link to return the index page as a whole.

Source: Internet
Author: User
This problem occurs in the project: After session-timeout, a new logon page is displayed on the left menu in targetNT_PHVIEW instead of a new overall logon page. solution: I added this code to my custom SessionFilter: package... syntaxHighlighte

This problem occurs in the project: After session-timeout, a new logon page will pop up on the left menu in target = "NT_PHVIEW" instead of a new overall logon page,

 

Solution:

Add the following code to my custom SessionFilter:

Package com. alu. gm. filter;

Import java. io. IOException;
Import java. io. PrintWriter;

Import javax. servlet .*;
Import javax. servlet. http .*;

Import com. alu. gm. util. LdapUtil;

Public class SessionFilter implements Filter
{
Public void init (FilterConfig fConfig) throws ServletException {}
 
Public void doFilter (ServletRequest req, ServletResponse res, FilterChain fChain) throws IOException, ServletException
{
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
String uri = request. getRequestURI ();
String contextPath = request. getContextPath ();
If (! Uri. equals (contextPath + "/index. jsp ")
&&! Uri. equals (contextPath + "/LoginServlet ")
&&! Uri. equals (contextPath + "/LogoutServlet ")
&&! Uri. equals (contextPath + "/images/logo_alcatel-lucent-2lines.gif "))
{
HttpSession session = request. getSession (false );
If (session = null | session. getAttribute (LdapUtil. LOGIN_PERSON) = null) // Check if it has passed validation
{
Response AchE (response); // Clear cache before forwarding
// Request. getRequestDispatcher ("/index. jsp"). forward (request, response );
PrintWriter out = res. getWriter ();
Out. println ("script");
Out. println ("window. top. location. href = 'index. jsp ';");
Out. println ("script");
Return;
}
}
FChain. doFilter (req, res );
}
/** Clear cache for client browser */
Public void upload AchE (HttpServletResponse response)
{
Response. setHeader ("Pragma", "No-cache ");
Response. setHeader ("Cache-Control", "no-cache ");
Response. setDateHeader ("Expires",-10 );
}
 
Public void destroy (){}

}


 

 

Appendix:

Usage of window. location. href, location. href, parent. location. href, top. location. href in js
"Window. location. href" and "location. href" indicate the current page Jump.
"Parent. location. href" is the previous page Jump.
"Top. location. href" is the outermost page Jump.
Example:
If A, B, C, and D are both html, D is the iframe of C, C is the iframe of B, and B is the iframe of A, if js in D is written like this
"Window. location. href", "location. href": D page Jump
"Parent. location. href": C page Jump
"Top. location. href": A page Jump
If form exists on Page D,

: Jump to the D page after the form is submitted
: A New Page is displayed after form is submitted.
: C page jump after form is submitted
: Jump to page A after form is submitted

If you are accessing the page in iframe, reload the outermost page




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.