• Post Reply Bookmark Topic Watch Topic
  • New Topic

request.getSession()  RSS feed

 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the diffrence between
request.getSession(true) and request.getSession(false);
 
George Hill
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getSession(true) will make a new session when no session existed. but getSession() do nothing.
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<B>getSession(true) will make a new session when no session existed. but getSession() do nothing. </B>
But always there will have a session......So what is the use of giving true???
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But always there will have a session......So what is the use of giving true???

If the previous session has timed out it returns a new. If there is no previous one then it returns a ne w one too.
What do you mean that there will be a session always.
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean whenever yhe user login there will have a session automaticall created by container???.....am I right???
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mathews P Srampikal:
I mean whenever yhe user login there will have a session automaticall created by container???.....am I right???

No..unless the first page displayed is a JSP..jsps create session by default.
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that means we have to call true always in the first page.is it??
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!