You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nicolas Barrera <nb...@gmail.com> on 2013/03/19 22:32:22 UTC

Keep component's state between requests

Hi,

I 'm trying to implement a component which has a form and a grid where grid
results are filtered by the form's input.

I 've found very interesting this jumpstart example:
http://jumpstart.doublenegative.com.au/jumpstart/together/filtercrud/persons

There I see how the filter input is being kept by means of adding it to the
url as a paramter with the @ActivationRequestParameter.

Now, I started trying to migrate that approach to a component, but I 'm
stucked in how to keep the value of the filter input,

- I think can't use a request parameter (@ActivationRequestParameter)
because it's a component not a page
- I cant' use activate/passivate events for the same reasons (I 'm in a
component)
- I know I can use @Persist but I was trying to avoid it

do you think returning a link to the same page, adding request parameters
to the link at the end of the url  and on the next request grabbing the
Request and asking for that parameters is a good idea in order to keep
those values in the following request?

do you have any ideas on which would be a clever way to keep component's
state from a request to another without @Persist(ing) it?

cheers and thanks


Nicolás.-

Re: Keep component's state between requests

Posted by Geoff Callender <ge...@gmail.com>.
It depends, of course, on your use case.

If, for example, you want the container to be able to specify an initial
filter value, then it makes perfect sense to provide the value in a
parameter. It is part of how the container configures the component.

If, for example, you want the page to be bookmarkable, able to restore the
filter value's state, then the bookmark has to include the filter value
because it is part of the page's state.

Viewed in that light, we're not "forcing" the container to know about the
context of the component. What we're doing is giving the container the
option to configure the component and the option to query configuration
later.

On 21 March 2013 01:25, Nicolas Barrera <nb...@gmail.com> wrote:

> Thank you both for your suggestions,
>
> I think I don't really like to force the container component to know about
> the context that the inner component needs,
>
> so I went for the @Persist with CLIENT strategy,
>
> Thank you again,
>
> cheers.
>
> Nicolás.-
>
>
> On Wed, Mar 20, 2013 at 1:13 AM, Geoff Callender <
> geoff.callender.jumpstart@gmail.com> wrote:
>
> > If you don't mind sharing the component's filter value with its container
> > then this does what you want, because parameters are bi-directional:
> >
> >
> >
> >
> http://jumpstart.doublenegative.com.au/jumpstart/together/componentscrud/persons
> >
> > On 20 March 2013 08:59, Lance Java <la...@googlemail.com> wrote:
> >
> > > You can bind your component parameter to an activation context on your
> > > page.
> > >
> > > You can also use @Persist(PersistanceConstants.CLIENT) which will use a
> > > request parameter with a component specific name.
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://tapestry.1045711.n5.nabble.com/Keep-component-s-state-between-requests-tp5720563p5720565.html
> > > Sent from the Tapestry - User mailing list archive at Nabble.com.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
>

Re: Keep component's state between requests

Posted by Nicolas Barrera <nb...@gmail.com>.
Thank you both for your suggestions,

I think I don't really like to force the container component to know about
the context that the inner component needs,

so I went for the @Persist with CLIENT strategy,

Thank you again,

cheers.

Nicolás.-


On Wed, Mar 20, 2013 at 1:13 AM, Geoff Callender <
geoff.callender.jumpstart@gmail.com> wrote:

> If you don't mind sharing the component's filter value with its container
> then this does what you want, because parameters are bi-directional:
>
>
>
> http://jumpstart.doublenegative.com.au/jumpstart/together/componentscrud/persons
>
> On 20 March 2013 08:59, Lance Java <la...@googlemail.com> wrote:
>
> > You can bind your component parameter to an activation context on your
> > page.
> >
> > You can also use @Persist(PersistanceConstants.CLIENT) which will use a
> > request parameter with a component specific name.
> >
> >
> >
> > --
> > View this message in context:
> >
> http://tapestry.1045711.n5.nabble.com/Keep-component-s-state-between-requests-tp5720563p5720565.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>

Re: Keep component's state between requests

Posted by Geoff Callender <ge...@gmail.com>.
If you don't mind sharing the component's filter value with its container
then this does what you want, because parameters are bi-directional:


http://jumpstart.doublenegative.com.au/jumpstart/together/componentscrud/persons

On 20 March 2013 08:59, Lance Java <la...@googlemail.com> wrote:

> You can bind your component parameter to an activation context on your
> page.
>
> You can also use @Persist(PersistanceConstants.CLIENT) which will use a
> request parameter with a component specific name.
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Keep-component-s-state-between-requests-tp5720563p5720565.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Keep component's state between requests

Posted by Lance Java <la...@googlemail.com>.
You can bind your component parameter to an activation context on your page. 

You can also use @Persist(PersistanceConstants.CLIENT) which will use a
request parameter with a component specific name. 



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Keep-component-s-state-between-requests-tp5720563p5720565.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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