You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Ted Steen <te...@gmail.com> on 2007/02/05 02:49:18 UTC

T5: @Persist behaviour

Hi,

PageA injects PageB, in PageB i have a field "someProp" which is
annotated with @Persist("flash").
In the code on PageA.onSuccess() I do pageB.setSomeProp(value) and return pageB.
now PageB shows up with the value in "someProp", but on the next
request (e.g. after form submission with errors) the value is null..
is this expected behaivour?

-- 
/ted

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: T5: @Persist behaviour

Posted by Howard Lewis Ship <hl...@gmail.com>.
The values in the flash reset when they are next used (to restore
properties of page B), not when the page containing the flashed values
is rendered. This is subtly different than tapestry-flash for T4,
because the structure of the request cycle is a bit different
(component event requests send page render redirects).

So when page A is resubmitted with errors, the values for page B are
lost (assuming some part of the form submission accesses page B).  To
really pin it down, I'd need to see more code.

The solution is to only set values on page B immediately before
returning the page B instance from page A's onSuccess().

On 2/4/07, Ted Steen <te...@gmail.com> wrote:
> Hi,
>
> PageA injects PageB, in PageB i have a field "someProp" which is
> annotated with @Persist("flash").
> In the code on PageA.onSuccess() I do pageB.setSomeProp(value) and return pageB.
> now PageB shows up with the value in "someProp", but on the next
> request (e.g. after form submission with errors) the value is null..
> is this expected behaivour?
>
> --
> /ted
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org