• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session problem

 
Varun Nayudu
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having difficulty with session .When i do request.getSession() and check if its new or no by .isNew() it return's false.

I have only 1 html
and a servlet where i create a new session by getSession() but when i check it in the servlet it show's it already has a session.

I am confused should'nt the session be created by us and how come a session already exists when i have not yet declared any session in the html page .
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Varun Nayudu:
but when i check it in the servlet it show's it already has a session.


how you test it?...

note: commonly container will create a session for you ... if you use request.getSession(false)...it wont create new one...instead maintain the existing one(i think in your case , the existing one is created by container)... then, using isNew()...you can test whether client is request first time or not with the sessionID

Got it ?....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic