Stephanie,

I have a similar problem in my app - I have persistent page properties that 
needed to remain on the page for a period of time, but at some point they 
should basically be cleared, so as not to clog up the session.

The solution I came up with was to define a certain point (eg. top-level menu 
selection in my app) where you can clear all persistent page properties.

So my top-level menus are DirectLinks, that call a listener that does 
something like this:


public abstract component HeaderMenu extends BaseComponent {

    public String showBookingPage(IRequestCycle cycle){
        PageUtils.clearAllPageStates(cycle);
        return "Booking";
    }

    public String showSearchPage(IRequestCycle cycle){
        PageUtils.clearAllPageStates(cycle);
        return "Search";
    }

    ..... {etc}

}

public class PageUtils {

    public static void clearAllPageStates(IRequestCycle cycle){
        List<String> pageNames = 
cycle.getInfrastructure().getSpecificationSource().getApplicationNamespace().getPageNames();
        for (String pageName : pageNames){
            cycle.forgetPage(pageName);
        }
    }
}


On Fri 16 December 2005 03:53, Stephane Decleire wrote:
> I thought it has because i have never found a solution to clean properly
> persistent properties on a page in the special case where this page is
> left using an ExternalLink (cause i haven't found the right place to
> call the forgetPage ou the discardPage function in this specific case).
> But i'm just a newbie ...
>
> Stephane
>
> Geoff Longman wrote:
> >has nothing to do with links...
> >
> >  /**
> >     *  Much like [EMAIL PROTECTED] IEngine#forgetPage(String)}, but the page
> >stays active and can even
> >     *  record changes, until the end of the request cycle, at which
> >point it is discarded
> >     *  (and any recorded changes are lost).
> >     *  This is used in certain rare cases where a page has persistent
> >state but is
> >     *  being renderred "for the last time".
> >     *
> >     *  @since 2.0.2
> >     *
> >     **/
> >
> >    public void discardPage(String name);
> >
> >On 12/15/05, Stephane Decleire <[EMAIL PROTECTED]> wrote:
> >>cycle.discardPage() is the solution where there is a listener (as in
> >>DirectLink) but what is the right way  to discard persistent properties
> >>when a page is left using an ExternalLink ?
> >>
> >>Stephane
> >>
> >>Geoff Longman wrote:
> >>>The short answer is no, there is no automatic cleanup.
> >>>
> >>>cycle.discardPage() will turf persistent properties
> >>>
> >>>if you have private fields you have to clean them up yourself using
> >>>the detach mechanism.
> >>>
> >>>Geoff
> >>>
> >>>On 12/15/05, Ryan Pan <[EMAIL PROTECTED]> wrote:
> >>>>Hi all,
> >>>>   Can any body tell me how to clean the information stored in the page
> >>>>automatically?
> >>>>   I encounter a issue that when I come back to the page that had been
> >>>>to,informations had not been cleaned.
> >>>>   So any answer?
> >>>>
> >>>>Thanks,
> >>>>Ryan.
> >>>
> >>>--
> >>>The Spindle guy.           http://spindle.sf.net
> >>>Get help with Spindle:
> >>>http://lists.sourceforge.net/mailman/listinfo/spindle-user
> >>>Announcement Feed:
> >>>http://www.jroller.com/rss/glongman?catname=/Announcements
> >>>Feature Updates:            http://spindle.sf.net/updates
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>--
> >>Stéphane Decleire
> >>
> >>05 56 57 99 20
> >>06 63 78 69 06
> >
> >--
> >The Spindle guy.           http://spindle.sf.net
> >Get help with Spindle:
> >http://lists.sourceforge.net/mailman/listinfo/spindle-user
> >Announcement Feed:
> >http://www.jroller.com/rss/glongman?catname=/Announcements
> >Feature Updates:            http://spindle.sf.net/updates
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to