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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

notification not as expected from session binding listener

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi all,

When i was practising one HttpSessionBindingListener program from HFSJ, I noticed that the listener methods are not producing the results as I expected.

The program was to print 'bound', when an object of type X is bound to the session and print 'unbound', when it is unbound. I added the object of type X two times using the code. The session attributes with name "sample" has been set in the valueBound and valueUnbound methods for monitoring in the doGet method of the servlet.

( relevant parts shown below ; request, session and pw are Servletrequest,HttpSession and PrintWriter objects).

INSIDE doGet METHOD


The code used for the class implementing HttpSessionBindingListener X is




Result obtained is


I expected that when I bind "new X()" for the second time to the same key, the first bound object will be removed and the valueUnbound method will be called(as well as valueBound). This is not happening. why?

"System.out.print("B")" ( commented in the question) is not producing any output.why

Please help in this topic.

thanks in advance
sasikumar
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please do not post the same question more than once.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic