Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Context-param doubt

 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following can be used to retrieve the name or value of context param?

HttpSessionListener
HttpSessionAttributeListener
HttpSessionBindingListener
HttpSessionActivationListener

Thanks
Srividhya
 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems like a trick question but I would have to say they all do. This is because all are passed an EventObject (subclass) that has reference to the associated HttpSession object. Through HttpSession.getContext(), the above listeners can call the associated parameter methods to retrieve the names and values of the context parameters.
 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but the answer given as b & c. Dont know why a & d are wrong.
 
Dee Brown
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it was a trick question.

Your failure to provide that information up front is likely the reason why your question went unanswered for as long as it did. Your failure to provide information on where the question came from leaves little else to go on. The idea here is to make it as easy as possible for others to answer your question. If you also include where the question is from maybe someone else has come across it and has the answer, or knows that the provided answer is in fact wrong (because they reviewed the errata).

However, in this case (assuming they are listed in A-D alphabetical order), I have not identified why A and D would be wrong. Extensive analysis was not performed because it does not appear to be necessary.
 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From my knowledge below two methoda are available only in HttpSessionAttributeListener and HttpSessionBindingListener which are responsible for accessing the name and value for the param.

1: java.lang.String getName()
2: java.lang.Object getValue()



In HttpSessionActivationListener and HttpSessionListener these methods are not available.
Follow this link:
SessionListener
 
Check your pockets for water buffalo. You might need to use this tiny ad until locate a water buffalo:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic