Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic