You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Davide Vecchi <dv...@amc.dk> on 2016/05/02 11:12:22 UTC

Changing Grid.currentPage persistency to flash

Hi everybody

I see that the instance field that holds the current page number of a grid (org.apache.tapestry5.corelib.components.Grid.currentPage) is annotated with @Persist .

This has the probably desirable effect that f.ex. if I am on webpage A and it has a grid and I browse to its page #2 and then I go to another webpage and then I go back to webpage A its grid is still on its page #2 where I had left it.

However in my case this is not desirable and I would prefer that the grid page number is not remembered across different webpages.

Removing the @Persist annotation of Grid.currentPage instance field altogether would cause the impossibility to browse grid pages at all because the grid pager does a page reload and this loses the currentPage value, but persisting that value just until the next request - to preserve that value during the page reload  - seems to work fine: I changed the annotation from

@Persist

to

@Persist(PersistenceConstants.FLASH)

and I'm testing my pages to make sure this works. However I am also wondering if in theory changing that persistency to flash might be a bad idea for reasons that I don't know and that my tests so far are not showing. Does anyone have any opinion about this ?

Re: Changing Grid.currentPage persistency to flash

Posted by Barry Books <tr...@gmail.com>.
I have not changed it to flash but I did write a persistence strategy to
put the values is the url. I would agree that persisting the values in the
session has issues. The only problem with using the URL is if you have more
than one grid on a page you have to name the query parameters correctly.
Using the URL makes the grid stateless and bookmarkable.

On Monday, May 2, 2016, Davide Vecchi <dv...@amc.dk> wrote:

> Thanks, I didn't know about Persistence Strategy Inheritance, it's good
> info. In this specific case I probably will not need to use it because we
> have already heavily customized the grid code, but I will certainly go for
> this inheritance mechanism when I need to control persistency on a
> component basis for non-customized components.
>
> If anyone still has any observation, opinion or just guess about whether
> using flash persistency for the Grid.currentPage instance field might not
> be that good an idea I'd still like to hear about that.
>
>
> -----Original Message-----
> From: Chris Poulsen [mailto:mailinglist@nesluop.dk <javascript:;>]
> Sent: Monday, May 2, 2016 13:11
> To: Tapestry users <users@tapestry.apache.org <javascript:;>>
> Subject: Re: Changing Grid.currentPage persistency to flash
>
> I haven't used the grid with flash persistence, so I cannot comment on
> that.
>
> But I just want to let you know that you can control the behavior of
> @Persist inside the Grid using "Persistence Strategy Inheritance" (
> http://tapestry.apache.org/persistent-page-data.html ) without having to
> alter the component itself.
>
> --
> Chris
>
> On Mon, May 2, 2016 at 11:12 AM, Davide Vecchi <dv@amc.dk <javascript:;>>
> wrote:
>
> > Hi everybody
> >
> > I see that the instance field that holds the current page number of a
> > grid
> > (org.apache.tapestry5.corelib.components.Grid.currentPage) is
> > annotated with @Persist .
> >
> > This has the probably desirable effect that f.ex. if I am on webpage A
> > and it has a grid and I browse to its page #2 and then I go to another
> > webpage and then I go back to webpage A its grid is still on its page
> > #2 where I had left it.
> >
> > However in my case this is not desirable and I would prefer that the
> > grid page number is not remembered across different webpages.
> >
> > Removing the @Persist annotation of Grid.currentPage instance field
> > altogether would cause the impossibility to browse grid pages at all
> > because the grid pager does a page reload and this loses the
> > currentPage value, but persisting that value just until the next
> > request - to preserve that value during the page reload  - seems to
> > work fine: I changed the annotation from
> >
> > @Persist
> >
> > to
> >
> > @Persist(PersistenceConstants.FLASH)
> >
> > and I'm testing my pages to make sure this works. However I am also
> > wondering if in theory changing that persistency to flash might be a
> > bad idea for reasons that I don't know and that my tests so far are
> > not showing. Does anyone have any opinion about this ?
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> <javascript:;>
> For additional commands, e-mail: users-help@tapestry.apache.org
> <javascript:;>
>

RE: Changing Grid.currentPage persistency to flash

Posted by Davide Vecchi <dv...@amc.dk>.
Thanks, I didn't know about Persistence Strategy Inheritance, it's good info. In this specific case I probably will not need to use it because we have already heavily customized the grid code, but I will certainly go for this inheritance mechanism when I need to control persistency on a component basis for non-customized components.

If anyone still has any observation, opinion or just guess about whether using flash persistency for the Grid.currentPage instance field might not be that good an idea I'd still like to hear about that.
  

-----Original Message-----
From: Chris Poulsen [mailto:mailinglist@nesluop.dk] 
Sent: Monday, May 2, 2016 13:11
To: Tapestry users <us...@tapestry.apache.org>
Subject: Re: Changing Grid.currentPage persistency to flash

I haven't used the grid with flash persistence, so I cannot comment on that.

But I just want to let you know that you can control the behavior of @Persist inside the Grid using "Persistence Strategy Inheritance" ( http://tapestry.apache.org/persistent-page-data.html ) without having to alter the component itself.

--
Chris

On Mon, May 2, 2016 at 11:12 AM, Davide Vecchi <dv...@amc.dk> wrote:

> Hi everybody
>
> I see that the instance field that holds the current page number of a 
> grid
> (org.apache.tapestry5.corelib.components.Grid.currentPage) is 
> annotated with @Persist .
>
> This has the probably desirable effect that f.ex. if I am on webpage A 
> and it has a grid and I browse to its page #2 and then I go to another 
> webpage and then I go back to webpage A its grid is still on its page 
> #2 where I had left it.
>
> However in my case this is not desirable and I would prefer that the 
> grid page number is not remembered across different webpages.
>
> Removing the @Persist annotation of Grid.currentPage instance field 
> altogether would cause the impossibility to browse grid pages at all 
> because the grid pager does a page reload and this loses the 
> currentPage value, but persisting that value just until the next 
> request - to preserve that value during the page reload  - seems to 
> work fine: I changed the annotation from
>
> @Persist
>
> to
>
> @Persist(PersistenceConstants.FLASH)
>
> and I'm testing my pages to make sure this works. However I am also 
> wondering if in theory changing that persistency to flash might be a 
> bad idea for reasons that I don't know and that my tests so far are 
> not showing. Does anyone have any opinion about this ?
>

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

Re: Changing Grid.currentPage persistency to flash

Posted by Chris Poulsen <ma...@nesluop.dk>.
I haven't used the grid with flash persistence, so I cannot comment on that.

But I just want to let you know that you can control the behavior of
@Persist inside the Grid using "Persistence Strategy Inheritance" (
http://tapestry.apache.org/persistent-page-data.html ) without having to
alter the component itself.

--
Chris

On Mon, May 2, 2016 at 11:12 AM, Davide Vecchi <dv...@amc.dk> wrote:

> Hi everybody
>
> I see that the instance field that holds the current page number of a grid
> (org.apache.tapestry5.corelib.components.Grid.currentPage) is annotated
> with @Persist .
>
> This has the probably desirable effect that f.ex. if I am on webpage A and
> it has a grid and I browse to its page #2 and then I go to another webpage
> and then I go back to webpage A its grid is still on its page #2 where I
> had left it.
>
> However in my case this is not desirable and I would prefer that the grid
> page number is not remembered across different webpages.
>
> Removing the @Persist annotation of Grid.currentPage instance field
> altogether would cause the impossibility to browse grid pages at all
> because the grid pager does a page reload and this loses the currentPage
> value, but persisting that value just until the next request - to preserve
> that value during the page reload  - seems to work fine: I changed the
> annotation from
>
> @Persist
>
> to
>
> @Persist(PersistenceConstants.FLASH)
>
> and I'm testing my pages to make sure this works. However I am also
> wondering if in theory changing that persistency to flash might be a bad
> idea for reasons that I don't know and that my tests so far are not
> showing. Does anyone have any opinion about this ?
>