You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joel Wiegman <Jo...@dswinc.com> on 2008/04/02 20:20:04 UTC
T5.0.11: @Persist("flash") values are not retained if validation fails
All,
I've noticed that if validation fails on my page, any field annotated
with @Persist("flash") is not retained when the response is rendered.
Per the documentation for @Persist("flash"), this doesn't appear to be
expected behavior.
Should I put this in JIRA?
Joel
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5.0.11: @Persist("flash") values are not retained if validation fails
Posted by Robert Zeigler <ro...@scazdl.org>.
Hi Joel.
What you put in that onValidateForm is going to be important. :)
@Persist("flash") persists a value in the session until (and only
until) it has been re-accessed (once).
At that point, it is yanked from the session. So if you're reading
your List<String> values in the onValidateForm, you're going to wind
up with issues.
It turns out that you can work around this by simply doing:
values=values;
Your IDE will probably complain about this being a noop... but it
isn't, since this code will be instrumented at runtime.
Cheers,
Robert
On Apr 3, 2008, at 4/36:34 AM , Joel Wiegman wrote:
> Sure... An example is below. The "values" field disappears from the
> screen if validation fails.
>
> //JAVA
> public class MyClass {
>
> //(assume getters and setters exist)
> @Persist("flash")
> List<String> values;
>
> public void onPrepare() {
> //populate values with stuff
> }
>
> public void onValidateForm() {
> //possibly some form validation here
> }
>
> }
>
> //TML
>
> <t:form>
>
> //other fields with validation rules would be here
>
> <div t:type="loop" source="values" value="selectedValue">
> ${selectedValue}
> </div>
>
> <t:form>
>
> -----Original Message-----
> From: Ted Steen [mailto:ted.steen@gmail.com]
> Sent: Wednesday, April 02, 2008 6:10 PM
> To: Tapestry users
> Subject: Re: T5.0.11: @Persist("flash") values are not retained if
> validation fails
>
> Could you give a simple example of the problem?
>
> 2008/4/2, Joel Wiegman <Jo...@dswinc.com>:
>> As an addendum, I shouldn't say "any field". The culprit is a List
>> that gets iterated over in the TML.
>>
>>
>> -----Original Message-----
>> From: Joel Wiegman [mailto:JoelWiegman@dswinc.com]
>> Sent: Wednesday, April 02, 2008 2:20 PM
>> To: Tapestry users
>> Subject: T5.0.11: @Persist("flash") values are not retained if
>> validation fails
>>
>> All,
>>
>> I've noticed that if validation fails on my page, any field annotated
>
>> with @Persist("flash") is not retained when the response is rendered.
>>
>> Per the documentation for @Persist("flash"), this doesn't appear to
>> be expected behavior.
>>
>> Should I put this in JIRA?
>>
>> Joel
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> --
> /ted
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: T5.0.11: @Persist("flash") values are not retained if validation fails
Posted by Joel Wiegman <Jo...@dswinc.com>.
Sure... An example is below. The "values" field disappears from the
screen if validation fails.
//JAVA
public class MyClass {
//(assume getters and setters exist)
@Persist("flash")
List<String> values;
public void onPrepare() {
//populate values with stuff
}
public void onValidateForm() {
//possibly some form validation here
}
}
//TML
<t:form>
//other fields with validation rules would be here
<div t:type="loop" source="values" value="selectedValue">
${selectedValue}
</div>
<t:form>
-----Original Message-----
From: Ted Steen [mailto:ted.steen@gmail.com]
Sent: Wednesday, April 02, 2008 6:10 PM
To: Tapestry users
Subject: Re: T5.0.11: @Persist("flash") values are not retained if
validation fails
Could you give a simple example of the problem?
2008/4/2, Joel Wiegman <Jo...@dswinc.com>:
> As an addendum, I shouldn't say "any field". The culprit is a List
> that gets iterated over in the TML.
>
>
> -----Original Message-----
> From: Joel Wiegman [mailto:JoelWiegman@dswinc.com]
> Sent: Wednesday, April 02, 2008 2:20 PM
> To: Tapestry users
> Subject: T5.0.11: @Persist("flash") values are not retained if
> validation fails
>
> All,
>
> I've noticed that if validation fails on my page, any field annotated
> with @Persist("flash") is not retained when the response is rendered.
>
> Per the documentation for @Persist("flash"), this doesn't appear to
> be expected behavior.
>
> Should I put this in JIRA?
>
> Joel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
/ted
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5.0.11: @Persist("flash") values are not retained if validation fails
Posted by Ted Steen <te...@gmail.com>.
Could you give a simple example of the problem?
2008/4/2, Joel Wiegman <Jo...@dswinc.com>:
> As an addendum, I shouldn't say "any field". The culprit is a List that
> gets iterated over in the TML.
>
>
> -----Original Message-----
> From: Joel Wiegman [mailto:JoelWiegman@dswinc.com]
> Sent: Wednesday, April 02, 2008 2:20 PM
> To: Tapestry users
> Subject: T5.0.11: @Persist("flash") values are not retained if
> validation fails
>
> All,
>
> I've noticed that if validation fails on my page, any field annotated
> with @Persist("flash") is not retained when the response is rendered.
>
> Per the documentation for @Persist("flash"), this doesn't appear to be
> expected behavior.
>
> Should I put this in JIRA?
>
> Joel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
/ted
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: T5.0.11: @Persist("flash") values are not retained if validation fails
Posted by Joel Wiegman <Jo...@dswinc.com>.
As an addendum, I shouldn't say "any field". The culprit is a List that
gets iterated over in the TML.
-----Original Message-----
From: Joel Wiegman [mailto:JoelWiegman@dswinc.com]
Sent: Wednesday, April 02, 2008 2:20 PM
To: Tapestry users
Subject: T5.0.11: @Persist("flash") values are not retained if
validation fails
All,
I've noticed that if validation fails on my page, any field annotated
with @Persist("flash") is not retained when the response is rendered.
Per the documentation for @Persist("flash"), this doesn't appear to be
expected behavior.
Should I put this in JIRA?
Joel
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org