java - redirect user to login page -


i'm running j2ee application , need redirect user login page if session inactive.

i want use below javascript code session last accessed time , compare current time, , if more session timeout logout:-

<script>          setinterval(function() {              console.log('maxinactive interval ==  ' + <%=new date(session.getlastaccessedtime())%> );          }, 10000);     </script> 

i below error on console.log line:-

uncaught syntaxerror: missing ) after argument list

here display sources tab:-

console.log('maxinactive interval ==  ' + sun may 31 20:33:17 edt 2015 ); 

you should place single quote @ end of console.log argument

    setinterval(function() {          console.log('maxinactive interval == <%=new date(session.getlastaccessedtime())%>' );      }, 10000); </script> 

and don't need + operator, cannot concatenate javascript string java expressions.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -