Cool, i didn't even know about that particular event.
I just found that it's explained in the "Input Validation" section of
the docs.

Just thinking out loud, but wouldn't it be great if all the
notifications a component can send were documented with the component
documentation itself ?
Maybe some javadoc markup could be used to document the notifications in
the component class itself and then the reference doc generator could
pick those up ?


Howard Lewis Ship wrote:
> How about an onPrepare() event handler method to reset the _user field
> to a new User instance?
>
> On Jan 18, 2008 8:44 AM, Hugo Palma <[EMAIL PROTECTED]> wrote:
>   
>> Imagine the following use case:
>>
>> A page to register a new user. I have a User class so i'm all set.
>> The page class looks something like:
>>
>> @Meta("tapestry.persistence-strategy=flash") // because of the
>> validation tracker thing
>> public class Register {
>> @Persist
>> private User _user = new User();
>>
>> public User getUser() {
>>         return _user;
>>     }
>>
>>     public void setUser(User user) {
>>         _user = user;
>>     }
>> }
>>
>>
>> I'm not using the BeanEditForm component so my template just has a
>> couple of TextField components with it's value binded to the user bean
>> properties.
>> So, now the problem. Because of the way property persistence works, the
>> actual reference to the user property is kept, so instead of the
>> property being reset to a brand new instance it's given the kept reference.
>> This means that every time that i navigate to the register page the form
>> will have the values from the last time the form was submitted.
>>
>> I guess a workaround would be on every place where i navigate to this
>> page, to reset the user property before navigating to it. This isn't a
>> very good solution design wise and doesn't solve the problem when
>> someone accesses the page directly from it's url.
>>
>> So, how are you guys implementing such use case ?
>>
>> Thanks
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>     
>
>
>
>   

Reply via email to