Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

attributeReplaced method of HttpSessionAttributeListener

 
Kamal Tripathi
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider this piece of code

Employee.java


Person.java


HSAL.java


S1.java




Assume that HttpSessionAttributeListener is configured properly in the DD and /S1 is mapped to S1.java and name of application is sample. Also result.jsp is a simple jsp with some jsp:useBean, jsp:setProperty, jsp:getProperty tags

Now when I execute http://localhost:8080/sample/S1, I am getting this in the console as output



Can anyone explain the second output.
REPLACED: Name: person, Value = (pName: "KT")

I think I read somewhere in HFSJ that in case attribute is replaced, getValue method returns the OLD value of the attribute, hence here I was expecting stmt 2 to be

REPLACED: Name: person, Value = (pName: "nisha")
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somebody has already raised that issue here. That's strange. Maybe an implementation issue.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!