You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alexandr Kundirenko <ak...@gmail.com> on 2005/08/22 20:36:53 UTC

Clear page persistent properties in Tapestry4

Hello All,

I want to clear page persistent properties but they are not always cleared.
Is this code correct for Tapestry-4.0-beta-4?

//Get page and clear it's persistent properties
IPage page = cycle.getPage(pageName);
cycle.forgetPage(pageName);

//Get page again and check that properties are cleared
IPage become = cycle.getPage(pageName);
if(become instanceof BaseFormPage) {
   BaseFormPage form = (BaseFormPage) become;
   //Sometimes it is NULL here, sometimes it is not
   System.out.println("ITEM AFTER CLEARING=" + form.getItem());
}

getItem() used in this example is defined as persistent:
<property name="item" persist="session" />

Thank you, Alex


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


Re: Clear page persistent properties in Tapestry4

Posted by Howard Lewis Ship <hl...@gmail.com>.
The rule for Tapestry is that once a page is loaded, it is loaded. 
You can change the locale, and the page will still be in the old
locale.  You can clear persistent properties, and the loaded page
instance is not affected.

so this is normal and expected behavior.  A subsequent request would
not see any persistent properties for the page.

On 8/22/05, Alexandr Kundirenko <ak...@gmail.com> wrote:
> Hello All,
> 
> I want to clear page persistent properties but they are not always cleared.
> Is this code correct for Tapestry-4.0-beta-4?
> 
> //Get page and clear it's persistent properties
> IPage page = cycle.getPage(pageName);
> cycle.forgetPage(pageName);
> 
> //Get page again and check that properties are cleared
> IPage become = cycle.getPage(pageName);
> if(become instanceof BaseFormPage) {
>    BaseFormPage form = (BaseFormPage) become;
>    //Sometimes it is NULL here, sometimes it is not
>    System.out.println("ITEM AFTER CLEARING=" + form.getItem());
> }
> 
> getItem() used in this example is defined as persistent:
> <property name="item" persist="session" />
> 
> Thank you, Alex
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

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

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