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