In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article shows you how to deal with the problem of web login timeout giving hints to jump to the login page, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
1. For general page login timeout verification, you can use the filter filter, as follows:
Package com.lg.filter;import java.io.IOException;import javax.servlet.Filter;import javax.servlet.FilterChain;import javax.servlet.FilterConfig;import javax.servlet.ServletException;import javax.servlet.ServletRequest;import javax.servlet.ServletResponse;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import com.lg.func.MyFunc;public class LoginFilter implements Filter {public void destroy () {} public void doFilter (ServletRequest request, ServletResponse response,FilterChain chain) throws ServletException, IOException {HttpServletRequest request1= (HttpServletRequest) request;HttpServletResponse response1= (HttpServletResponse) response Chain.doFilter (request, response); / / release. Take it to the next chain or target resource String url=request1.getServletPath (); System.out.println ("before Demo1 filtering" + url); MyFunc myFunc = new MyFunc (request1,response1); System.out.println ("before Demo1 filtering" + url.startsWith ("/ index/")); if (myFunc.checkLogin2 () &! url.startsWith ("/ index/")) {response1.sendRedirect ("/ index_login.html");} System.out.println ("after Demo1 filtering") } public void init (FilterConfig arg0) throws ServletException {/ / TODO Auto-generated method stubSystem.out.println ("= init= filtered");}}
Web.xml configuration
Demo1Filtercom.lg.filter.LoginFilterDemo1Filter*.jsp
II. Ajax submission
Submit page, my page prompts pop-up frame to use asyncBox, can be changed to other jump
< pad > < Abstrcat > < pad > < pad >-1) {alert (success);} else {alert (failure) is returned to the login page if (checkLogin2 (msg)) {var obj=eval ('('+ msg+')'); if (obj.result.indexOf ("suc") >-1) {if (msg.indexOf ("DOCTYPE") >-1) {checkLogin (); return false;}} return true;} function checkLogin () {if (window.top! = window.self) {top.asyncbox.alert ('login timeout', 'prompt', function (action) {top.location.href='/login.jsp') });} else {asyncbox.alert ('login timed out, please login again', 'prompt', function (action) {_ window.location.href='/login.jsp';});}}
Background:
1. Before processing the data
If (checkLogin ()) return; / / check login, session expired or not logged in, automatically redirect public boolean checkLogin () throws IOException {boolean result = false;String html = ""; NativeObject u = SessionMng.getCurrentUser (request); / / verify login timeout if (u = = null) {html = "\ n" + "\ n" + "checkLogin ();\ n"; response.getWriter (). Println (html); result = true;} return result;}
Third, import excel asynchronously
Import excel function with AjaxUpload.js
The front-end submission page refers to the above
Background processing page:
If (! isLogin ()) {response.getWriter () .print ("DOCTYPE"); return;} / whether to log in to public boolean isLogin () {NativeObject u = SessionMng.getCurrentUser (request); if (u! = null) {return true;} else {return false;}}
four. Export excel files with window.open
The background is the same.
Front-end export page
Function export_excel () {$.ajax ({type: "post", url: "/ admin/inc/checkLogin.jsp", async:false,// synchronization success:function (msg) {if (checkLogin2 (msg)) {window.open ("perfm_excel.jsp?" + $('# Form1'). Serialize ());}}); login.jsp above is how to deal with the problem of web login timeout prompting to jump to the login page, have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.