Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding Listener Concept  RSS feed

 
yekkala krishna
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am following Hanumant Deshmukh material for preparation of SCWCD Exam.I have small query regarding the following question.Actually when any object is added to a session HttpSessionBindingListener will notify.but they are saying HttpSessionAttributeListener will call. Can Anybody explain clearly regarding the below question?

Which interface must a class implement so that instances of the class are
notified after any object is added to a session?
A. javax.servlet.http.HttpSessionListener
B. javax.servlet.http.HttpSessionValueListener
C. javax.servlet.http.HttpSessionBindingListener
D. javax.servlet.http.HttpSessionAttributeListener
Answer: D

With Regards,
Rama Krishna.Y
 
Ankit Garg
Sheriff
Posts: 9609
36
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question is asking about "any object" added to session. if your class implements HttpSessionBindingListener, then it will be notified when instances of that class are added to the session. A class that implements HttpSessionAttributeListener is notified when an instance of any object is added to the session...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!