File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes attributeReplaced method of HttpSessionAttributeListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "attributeReplaced method of HttpSessionAttributeListener" Watch "attributeReplaced method of HttpSessionAttributeListener" New topic

attributeReplaced method of HttpSessionAttributeListener

Kamal Tripathi
Ranch Hand

Joined: Oct 02, 2008
Posts: 86
Consider this piece of code

Assume that HttpSessionAttributeListener is configured properly in the DD and /S1 is mapped to 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")

Kamal Tripathi
SCJP 1.4 90%, SCWCD5 94%, Next SCDJWS--> In Naescent stage. Researching abt exam and material itself.
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

Somebody has already raised that issue here. That's strange. Maybe an implementation issue.

[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
subject: attributeReplaced method of HttpSessionAttributeListener
It's not a secret anymore!