Bugs item #608768, was opened at 2002-09-13 02:09
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=104754&aid=608768&group_id=4754

Category: Tapestry
Group: bug
Status: Open
Resolution: None
Priority: 5
Submitted By: jason owens (jlowenz)
Assigned to: Nobody/Anonymous (nobody)
Summary: Changes saved AFTER IPage.detach()

Initial Comment:
If one creates a new object in a page constructer (e.g.
a HashMap for tracking sparse changes to a list), and
proceeds to call fireObservedChange("hashmap", hashmap)
when a value is added to that hashmap, the expected
behavior is that the hashmap will be saved into the
session for use during form rewinding, etc...

However, consider that instead of setting this hashmap
null in the detach() method, we only want to clear() it
for the next time around: so we call hashmap.clear() in
the detach() method.

The result is that your data will NOT be observed,
since it is being saved to the session AFTER the page
is detached (and thus results in a cleared hashmap). 

There are two ways around this: do not modify the
object in detach(), instead just null it and create it
new next time the page is loaded (where do you do that,
BTW?) OR send a clone() of the map to the
fireObservedChange method.

It is very confusing when you expect to be able to do
any kind of initialization in the detach() method.

----------------------------------------------------------------------

>Comment By: Howard Lewis Ship (hship)
Date: 2002-09-13 07:02

Message:
Logged In: YES 
user_id=26816

The way persistent page properties work is that the page 
recorder holds a reference to your object.  In theory, you 
should not make changes to persistent properties once the 
render takes place.

In your situation, just set the property to null inside detach().

On a later request cycle, the recorder will restore the property 
from the retained instance.

Looking at your example ... does the Map have to be page 
persistent?  It sounds like you want to clear it out at the end 
of the request cycle ... thats a transient, not a persistent, 
property.

Again, the documentation for detach() is that it returns the 
page to the same state as it was immediately after creation.

I'd like to close this bug, I want to hear your response first.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=104754&aid=608768&group_id=4754


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer

Reply via email to