This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
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).
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