< Back

Document Subject: Keep XPages Page alive stop session lapsing without using ExtLib
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#AFRR-AQCJ6R or http://A555F9/nn.nsf/ByAlias/AFRR-AQCJ6R

This code comes from 

https://www-10.lotus.com/ldd/ddwiki.nsf/dx/How_to_keep_XPages_Session_Alive_without_using_Extension_Library

<xp:scriptBlock id="KeepMySessionAlive"> 
                 <xp:this.value><![CDATA[ 
                        var dbpath = '#{javascript:facesContext.getExternalContext().getRequestContextPath()}'; 
                         var sTimeoutSec = (parseInt('#{javascript:context.getProperty("xsp.session.timeout")}' || 30) * 60) - 30; 
                         if(!XSP.keepAlive) 
                                {XSP.keepAlive=function xe_ka(){ 
                                    setTimeout('XSP.keepAlive()',sTimeoutSec * 1000); 
                                     dojo.xhrGet({url:dbpath + '/xsp/.ibmmodres/ping', 
                                                handleAs:'text', 
                                                preventCache:true}); 
                                     }; 
                         setTimeout('XSP.keepAlive()',sTimeoutSec * 1000)} 
                ]]></xp:this.value> 
         </xp:scriptBlock> 
 
 There are other scripts availabel that use partial refresh but they bring up horrible looking ajax errors.