


How to solve the problem of session expiration in JSP by jumping to the login page and jumping out of the iframe
When the session expires, you can use filters to set up redirect pages
public class ActionFilter extends HttpServlet implements Filter { private FilterConfig filterConfig; public void init(FilterConfig config) { this.filterConfig = config; } public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws ServletException, IOException { HttpServletRequest req = (HttpServletRequest) servletRequest; servletRequest.setCharacterEncoding(“UTF-8″); HttpServletResponse res = (HttpServletResponse) servletResponse; String url = req.getRequestURI(); SysUserVOImpl user = (SysUserVOImpl) req.getSession().getAttribute(“SysUser”); if (null == user) { if (!COMMON.isEmpty(url) && (url.endsWith(“newestlogin.jsp”) || url.endsWith(“UserLoginAction.jsp”) || url.endsWith(“login.jsp”) || url.endsWith(“loginAction.do”))) { filterChain.doFilter(servletRequest, servletResponse); } else { req.getRequestDispatcher(“/newestlogin.jsp”).forward(req, res); } } else { filterChain.doFilter(servletRequest, servletResponse); } }
Can be solved with javaScript
Add the following code between the page you want to control the jump to, such as login.jsp between
and :<script language=”JavaScript”> if (window != top) top.location.href = location.href; </script>
JS Refresh Frame Script Statement
//如何刷新包含该框架的页面用 <script language=JavaScript> parent.location.reload(); </script> //子窗口刷新父窗口 <script language=JavaScript> self.opener.location.reload(); </script> ( 或 <a href="javascript:opener.location.reload()">刷新</a> ) //如何刷新另一个框架的页面用 <script language=JavaScript> parent.另一FrameID.location.reload(); </script> 如果想关闭窗口时刷新或者想开窗时刷新的话,在<body>中调用以下语句即可。 <body onload="opener.location.reload()"> 开窗时刷新 <body onUnload="opener.location.reload()"> 关闭时刷新 <script language="javascript"> window.opener.document.location.reload() </script>
For more related articles on how to solve the problem of session expiration and jump to the login page and jump out of the iframe in Jsp, please pay attention to the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
