Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

sessionCreated() and sessionDestroyed() method  RSS feed

 
Mahtab Alam
Ranch Hand
Posts: 391
1
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need some clearance here

sessionCreated() method is called automatically when you call request.getSession()
and sessionDestroyed() method is get called when you call session.invalidate().

Does closing the browser means end of session ?
does closing browser calls sessionDestroyed() method.
 
Roberto Perillo
Bartender
Posts: 2273
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mahtab Alam wrote:Does closing the browser means end of session ?
does closing browser calls sessionDestroyed() method.


Not really. Closing the web browser does not mean that the associated session will be destroyed in the web container/application server. It will only be destroyed when it reaches the timeout.
 
Devaka Cooray
Marshal
Posts: 5323
575
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roberto Perillo wrote:It will only be destroyed when it reaches the timeout.
, or when you explicitly destroy it by calling session.invalidate()
 
Roberto Perillo
Bartender
Posts: 2273
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Devaka Cooray wrote:or when you explicitly destroy it by calling session.invalidate()


Agreed. It's just that he had stated that already
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Devaka Cooray wrote:or when you explicitly destroy it by calling session.invalidate()

Which there is no opportunity to do in the case when the browser is closed.
 
Mahtab Alam
Ranch Hand
Posts: 391
1
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that session is there until session time out or you explicitly call session.invalidate().

When does session start ?

Does session start when you first hit the application ?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When does session start ?

That depends on your web app. A session can be explicitly started in a servlet, or it can be started when a JSP is hit (but need not be).

Does session start when you first hit the application ?

Yes or no, depending on the above.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!