I have a issue on Java. I have a "index.jsp", now whenever it will run I want to check someone login or not. If no one is log in then only login button is show otherwise show the user name in place of login. To Solve this problem I use -
session.getsession(false);
if(session==null)
response.sendRedirect("login.jsp");
else
//rest of HTML Code.
but it is not working, it's always goes to else part.
Note:"index.jsp" is not forward from "logout.jsp" or anywhere where "session.invalidate()" is called. It is first time when the project run.