• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

always print old session

 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my jsp class


this is my servlet class



when i run this jsp and submit it always prints old session ?
why?
 
Charles 'King
Ranch Hand
Posts: 56
Eclipse IDE Postgres Database Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Samanthi perera wrote:
when i run this jsp and submit it always prints old session ?
why?


isNew() misleads many developers. isNew() will only return true if the server creates a session, but the client has not yet joined.

For example, turn off your cookies in your browser. Then run your application; it'll print "New Session" - Don't employ isNew to reliably check user authentication. Rely on user objects bound to sessions.
 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it works if i disable session on the jsp too.
anyway if new user comes the server gives a session ID for him with response.
then the next time user has the that ID .
when user fills the jsp file and submit .
why it dosn't happen here?
 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to identify when first time loging user is a new one
and from second time onwords user is a old one
and i need to print new user or old user
can anyone change this example
?
 
Charles 'King
Ranch Hand
Posts: 56
Eclipse IDE Postgres Database Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Samanthi perera wrote:I need to identify when first time loging user is a new one
and from second time onwords user is a old one
and i need to print new user or old user
can anyone change this example
?


Is this a homework assignment? We're here to help, not do your hw. Try this:

In your servlet:



 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
Charles 'King
Ranch Hand
Posts: 56
Eclipse IDE Postgres Database Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Samanthi perera wrote:thanks


You're welcome
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic