java - How to resolve session timeout error from client side? -
i stuck in situation related session timeout()while user still active on web page.
what happening on clicking particular link on webpage user redirected towards popup page. popup contains oracle form(basically applet) , applet embedded inside html page .
when user working on popup , requests going towards form server different jboss server . after time session times out .
i took following approach resolve issue :
i added jquery code below in popup page .
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script> var timer=0; function run(){ timer++; if(timer == 2){ $(document).bind('keyup mousemove',function(){ $(this).unbind('keyup mousemove'); $.ajax({ url: 'https://bdqap1.acclaris.com/bensol/common/refreshsession.jsp', cache: false, data: 'html', success: function(data,status) { } }); timer=0; }); } }// run ends here setinterval(run,1000); </script>
this code calls link in jboss server on mouse or keyboard movement on popup . should keep session alive while user active .
but approach not working jquery code not able detect movement on applet part . jquery not working applet in focus .
i wanted resolve issue client side . there better way ?
you binding , rebinding event handler every 2 seconds. might simpler ajax request every 30 seconds (or whatever time appropriate prevent session timing out:
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script> function run(){ $.ajax({ url: 'https://bdqap1.acclaris.com/bensol/common/refreshsession.jsp', cache: false, data: 'html', success: function(data,status) {} }); }// run ends here setinterval(run,30000); </script>
Comments
Post a Comment