You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Franz Amador <fg...@gmail.com> on 2008/05/23 20:42:12 UTC

Is persisting a component a bad idea?

I'm creating a set of tabs (using t5components' TabSet) with dynamic
content.  Each tab contains just a t:delegate whose "to" parameter is
bound to a property.  I have a drop-down menu of event links that set
those properties so that they reference the components that provide
the tabs' content.  This works fine.  However, if I refresh the
browser, the tab contents disappear.  Not too surprising, since the
properties to which the tabs are delegating get reset.

I can fix this by making those properties persistent, but this gives
me the willies.  Since those properties hold components, making them
persistent means that I'm keeping those components across requests by
putting them in the session.  This seems like a bad idea, since the
pages to which the components belong are presumably getting returned
to the page pool at the end of each request.

Are my fears justified?  Any ideas of a better way to handle my use
case?  Thanks in advance.

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


Re: Is persisting a component a bad idea?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Yes you fears are justified.

The right approach would be to store the component's ids (the
getCompleteId() method of ComponentResources).

You can use the ComponentSource service to convert a component id back
into a component.  It will take care of obtaining the right page, etc.

On Fri, May 23, 2008 at 11:42 AM, Franz Amador <fg...@gmail.com> wrote:
> I'm creating a set of tabs (using t5components' TabSet) with dynamic
> content.  Each tab contains just a t:delegate whose "to" parameter is
> bound to a property.  I have a drop-down menu of event links that set
> those properties so that they reference the components that provide
> the tabs' content.  This works fine.  However, if I refresh the
> browser, the tab contents disappear.  Not too surprising, since the
> properties to which the tabs are delegating get reset.
>
> I can fix this by making those properties persistent, but this gives
> me the willies.  Since those properties hold components, making them
> persistent means that I'm keeping those components across requests by
> putting them in the session.  This seems like a bad idea, since the
> pages to which the components belong are presumably getting returned
> to the page pool at the end of each request.
>
> Are my fears justified?  Any ideas of a better way to handle my use
> case?  Thanks in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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