Deepti Gupta wrote:
the result of request.getSession(false) is not returning "null"
What garbage value? Can you paste here?
Deepti Gupta wrote:its returning garbage value
Bear Bibeault wrote:Bad idea. You don't want to check for the session itself, but for data that you put into a session.
Bear Bibeault wrote:Why are you checking session.isNew()? There's no need for you to care.
When you log a user in, record a token in the session indicating so. Upon logout, remove the token. To check, see if the token exists. If not, a logout or session timeout has occured.
There's never a need to check the session itself.
jinx riley wrote:So you want to say that i should generate a session everytime a user visits the homepage.
But is generating a session for every user that visits the website a good idea
jinx riley wrote:what if a user directly accesses another page other than the home page...?
jinx riley wrote:what i am doing is...right now i am generating a session for a user only when he is logged in..!!
on the home page in order to check if a session exists i use the method request.getSession(false) so that a new session is not generated.
Paper beats rock. Scissors beats tiny ad.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earthhttps://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter