dimanche 31 mai 2015

redirect user to login page

I'm running a J2EE application and need to redirect the user to login page if the session is inactive.

I basically want to use the below javascript code to get the session last accessed time and compare with the current time, and if its more than the session timeout I will logout:-

<script>

        setInterval(function() {

            console.log('MaxInactive Interval ==  ' + <%=new Date(session.getLastAccessedTime())%> );

        }, 10000);
    </script>

I get the below error on the console.log line:-

Uncaught SyntaxError: missing ) after argument list

Here is the display from the sources tab:-

console.log('MaxInactive Interval ==  ' + Sun May 31 20:33:17 EDT 2015 );

Aucun commentaire:

Enregistrer un commentaire