Hello all,
I am having a problem implementing a logout feature in my website. I have a login page, once the user logs int their userId is stored to a session var as session.addAttribute("userId", userId); upon entry to every page on my site I need to check if user is logged in (has a valid session) if not redirect them to the login page. I tried the following but it gives me a nullpointerexception, due to the fact that I am referring to other session var and form properties in the same page.
if (null == session.getAttribute("userID"
{
redirect to page....
}
I also want to clear the browser cache for all the pages a user has visited on my site once they logout.
Can anyone please help, I am fairly new to Java and dont know any other way of doing this. If anyone knows a better way of doing it I would really appreciate it
Thanks in advance
I am having a problem implementing a logout feature in my website. I have a login page, once the user logs int their userId is stored to a session var as session.addAttribute("userId", userId); upon entry to every page on my site I need to check if user is logged in (has a valid session) if not redirect them to the login page. I tried the following but it gives me a nullpointerexception, due to the fact that I am referring to other session var and form properties in the same page.
if (null == session.getAttribute("userID"
redirect to page....
}
I also want to clear the browser cache for all the pages a user has visited on my site once they logout.
Can anyone please help, I am fairly new to Java and dont know any other way of doing this. If anyone knows a better way of doing it I would really appreciate it
Thanks in advance