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

java - Null response to php query in android, even though php works properly -

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -