Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session.invalidate()

 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i ran a program...and then destroyed the session...i think all the attributes associted with the session are also killed when the session is destroyed...unbound is being called for each of the attributes....

is this right? or did i explain it wrong?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, attributes will be unbound when the session is invalidated.
 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But i think that the listener associated with the attributes will not be called in that case.

Correct me if i am wrong.
 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when the session is destroyed...first the HttpSessionBindingListener is called...and then the HttpSessionAttributeListener
 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried it but HttpSessionAttributeListener was not being called when session was invalid.

I think i have to re verify it.
 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it does get called...i tested it just now
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure about HttpSessionAttributeListener, but HttpSessionBindingListener will be notified.
 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can i be wrong then..i just tried it
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can i be wrong then..i just tried it

Nobody is saying that you are wrong. However, "The container I'm using does it this way, so it works that way" is not a good argument. Containers sometimes do things unconventional things.
 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can both of you please let us know the containers you are using ?
 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it because am using tomcat 6? what if tis question comes in the exam?
 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, first HttpSessionBindingListener and then HttpSessionAttributeListener is being called.

I have tested it on TomCat 6
 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank god..thank you
 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But we have to test it again on an earlier version of TomCat
 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually i have read it here that the exam uses tomcat 5..i thought it woudnt matter....but am not changing any risk...switcing to 5.5
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic