当前位置: 代码迷 >> Ajax >> ExtJs session逾期
  详细解决方案

ExtJs session逾期

热度:348   发布时间:2013-04-07 12:50:11.0
ExtJs session过期
在时间为1分钟的给定session过期后
点击页面所有操作,页面将跳转到登陆页面

需要第一个页面 web.xml 来修改session-timeout
需要第二个页面 common.js 用来写前台
需要第三个页面来在后台写判断
应该是这样吧??
<session-config> 
   <session-timeout>1</session-timeout> 
</session-config>


第一个页面
function sessionTimeOut() { 
    function showResult(btn) { 
      top.location.href = 'login.jsp'; 
    }; 
    check_login = function () { 
        Ext.Ajax.request({ 
             url: './inc/session.jsp', 
             success: function (response, options) { 
             var responseArray = jsonDecode(response.responseText); 
                    if (responseArray.success == false) { 
                              Ext.MessageBox.show({ 
                                        title: '会话超时', 
                                        msg: '您的会话已由于超时而过期,请您重新登录!', 
                                        buttons: Ext.MessageBox.OK, 
                                         fn: showResult, 
                                         icon: Ext.MessageBox.WARNING 
                               }); 
                     } 
              } 
        }); 
}; 
check_login(); 
setTimeout(showResult, 3000);}

//Session过期,返回登录页面

第二个页面

/** 
* Session信息查看是否过期 

*/ 
public String sessionTimeOut(HttpServletRequest request,HttpServletResponse response){ 
HttpSession session = request.getSession(false);

if(session ==null ||session.getAttribute("loginInfo")==null) { 
  相关解决方案