I successfully implemented session activation and deactivation in my servlets as shown below:
HttpSession s = request.getSession();
s.setAttribute("uname", uname);
I deactivate the session in my logout servlet using:
HttpSession sess= request.getSession();
sess.invalidate();
Now, I am looking to verify the session status in my JSP page using JavaScript. I have a method that uses JSP code for this purpose, but I want to achieve it using a JavaScript function instead. The idea is to reload the same page if the session is active or redirect to login.jsp
if the session has expired. However, I'm struggling to find a solution for this at the moment.