It's not a secret anymore!*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Question about listener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Question about listener" Watch "Question about listener" New topic
Author

Question about listener

Patel Brijesh
Greenhorn

Joined: Jul 02, 2009
Posts: 16
can any one help me to answer which the listener is/are used and event object used for this situation.and which of the class will implement it ie attribute or other class
Q1:
An attribute wants to know when it has been moved from one session to another vm?
Q2:An attribute wants to know when it has been replaced in a session.?
Q3: when you want to be notified when anything is bound to session ??

can any one tell me the answer please.......
Nabila Mohammad
Ranch Hand

Joined: Nov 05, 2007
Posts: 661
The answer is simple and will be written straight in any book /website...
Try looking for it yourself...


The future belongs to those who believe in the beauty of their dreams.Dream BIG!
Poonam Kohli
Ranch Hand

Joined: Jun 10, 2009
Posts: 53
Patel Brijesh wrote:Q1: An attribute wants to know when it has been moved from one session to another vm?

HttpSessionActivationListener, HttpSessionEvent, Attribute

Patel Brijesh wrote:Q2:An attribute wants to know when it has been replaced in a session.?

HttpSessionBindingListener, HttpSessionBindingEvent, Attribute

Patel Brijesh wrote:Q3: when you want to be notified when anything is bound to session ??

HttpSessionAttributeListener, HttpSessionBindingEvent, Some other class

No question is bad.. However, spoon feeding is bad.. You could have read this in any book. Thanks for letting me practice with Listeners. I hope my answers are correct here.
Nabila Mohammad
Ranch Hand

Joined: Nov 05, 2007
Posts: 661
Q2:An attribute wants to know when it has been replaced in a session.?
HttpSessionAttributeListener, HttpSessionBindingEvent,


Q3 when you want to be notified when anything is bound to session ??
HttpSessionBindingListener, HttpSessionBindingEvent,

Poonam Kohli
Ranch Hand

Joined: Jun 10, 2009
Posts: 53
Nabila Mohammad wrote:Q2:An attribute wants to know when it has been replaced in a session.?
HttpSessionAttributeListener, HttpSessionBindingEvent,


Q3 when you want to be notified when anything is bound to session ??
HttpSessionBindingListener, HttpSessionBindingEvent,



Dont you think you have flipped them around?
Nabila Mohammad
Ranch Hand

Joined: Nov 05, 2007
Posts: 661
HttpSessionAttributeListener is for session attributes that are added, removied or replaced
Its has methods:
attributeAdded()
attributeRemoved()
attributeReplaced()


HttpSessionBindingListener is for sessions attribute that are bound to the session
It has methods :
valueBound()
valueUnbound()
vani venkat
Ranch Hand

Joined: Nov 21, 2006
Posts: 142
hi patel
just curious to know ..where did you get this question from?


SCJP 1.4, SCWCD 1.5
Poonam Kohli
Ranch Hand

Joined: Jun 10, 2009
Posts: 53
vani venkat wrote:hi patel
just curious to know ..where did you get this question from?


Seems he is copying the question from HFSJ worksheet in chapter 6.

I just finished that chapter this afternoon and I know it is there.
vani venkat
Ranch Hand

Joined: Nov 21, 2006
Posts: 142
Q3: when you want to be notified when anything is bound to session ??



ans is httpSessionAttributeListener for this question.

Nabila, httpSessionBindingListener will notify an "object" when attributes of that type are added to session. since in this question, it doesnot specify one single object rather wants to be notfied when anything is bound to session, i think httpSessionAttributeListener is appropriate in this situation.

I am not sure about Q2 as it talks about replaced and the notification is to be sent to Object itself. can some one explain this.
Poonam, thanks for the info. i am abit skeptic about wordings of Q2.
Patel Brijesh
Greenhorn

Joined: Jul 02, 2009
Posts: 16
Nabila Mohammad wrote:Q2:An attribute wants to know when it has been replaced in a session.?
HttpSessionAttributeListener, HttpSessionBindingEvent,


Q3 when you want to be notified when anything is bound to session ??
HttpSessionBindingListener, HttpSessionBindingEvent,


For Q2 HttpSessionListnener implementing class will not be Attribute class
For Q3 HttpSessionBindingListener will be implemented by Attribute class so how would we know?

Thanks, for your help....
will allways looking forward for your and javaRanch memeber's help in Difficult situation.
Patel Brijesh
Greenhorn

Joined: Jul 02, 2009
Posts: 16
Poonam Dhillon wrote:
Patel Brijesh wrote:Q1: An attribute wants to know when it has been moved from one session to another vm?

HttpSessionActivationListener, HttpSessionEvent, Attribute

Patel Brijesh wrote:Q2:An attribute wants to know when it has been replaced in a session.?

HttpSessionBindingListener, HttpSessionBindingEvent, Attribute

Patel Brijesh wrote:Q3: when you want to be notified when anything is bound to session ??

HttpSessionAttributeListener, HttpSessionBindingEvent, Some other class

No question is bad.. However, spoon feeding is bad.. You could have read this in any book. Thanks for letting me practice with Listeners. I hope my answers are correct here.


are you sure about these answer to be correct or your answer after this connversation ie . in second conversation is correct. it seems that your first conversation's answers are correct .. do let me know.. I have read same book but not able to work on common sense as it cannot be used for answer important in exam ,better to be clear about answer rather than depending on Guesses.

Thanks.
 
jQuery in Action, 2nd edition
 
subject: Question about listener
 
Similar Threads
Regarding HttpSessionAttributeListener and HttpSessionBindingListener
HttpSessionAttributeListener
Listener configure in DD
clarification
287 Pre-assessment test questions - Please answer