当会话到期时,我做了一个简单的页面移动到另一个页面。我已将时间设置为 50 秒,之后它将移动到页面但不幸的是它没有移动,我无助地知道哪里出了问题。如果您能解决我的问题,我将不胜感激
function x(){
var timeOut =<%=session.getAttribute("login")%>;
var checkTimeout;
checkTimeOut = function(){
if(timeOut==null || timeOut==""){
window.location.replace("failedSession.jsp");
//document.getElementById("b").innerHTML="session timed out";
// redirect to timeout page
}else{
window.setTimeout(checkTimeOut, 1000); // check once per second
}}
checkTimeOut(); // this is where you insert checkTimeOut function so that when you call x(), this will execute in the end.
}