You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by JIM WEAVER <we...@gmail.com> on 2005/04/13 01:38:51 UTC

Handing objects off between more than two pages

Hi,

We are developing a tapestry application that has an online
registration series of pages/forms (a wizard type deal, where info is
collected page by page and business transaction to register them
occurs at the end of the sequence).

I know that I can hand an object from page1 to page2 directly, which
Howard referred to as the "Tapestry Bucket Brigade" on the wiki :

http://wiki.apache.org/jakarta-tapestry/MoreFrequentlyAskedQuestions

In this scenario, though, we are accumulating info gradually over four
or five pages.

I still expected bucket brigade approach to work, but we are having a
problem.  The scenario is:

page1 form listener sets object on page2 directly, then calls
cycle.activate on that page (works)
page2 renders (works - object that was set from page1 still correct)
page2 submits - at this point in the form listener for page2 my object
is now null.

I'm guessing that when page 2 submits, since that is a new http
request, that I have no guarantee that the same instance of the page2
class is being used from the pool, so it makes sense to me that I'm
losing the reference to the object that was handed down from page1,
but I was kind of hoping that tapestry would work some magic for me
here ;-).

We resolved the problem so far by making the property for the object
on page2 persistent, but I'm not too happy about that.

In Struts I might use a session-scoped form for something like this,
and then of course you have to manage when the form gets pulled from
the session if you don't want it hanging around until the session
expires / is terminated.  I think that's pretty much the equivalent of
using the persistent property to do this in Tapestry.

I'm new to Tapestry, so I'm probably missing something obvious ;-).

TIA,
Jim

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


Re: Handing objects off between more than two pages

Posted by Jamie Orchard-Hays <ja...@dang.com>.
You could put the info into the visit object. I'd made a hash or a bean 
and put it in Visit. I do this with a shopping cart-style object I use 
in one of Darden's apps.

Jamie
On Apr 12, 2005, at 7:38 PM, JIM WEAVER wrote:

> Hi,
>
> We are developing a tapestry application that has an online
> registration series of pages/forms (a wizard type deal, where info is
> collected page by page and business transaction to register them
> occurs at the end of the sequence).
>
> I know that I can hand an object from page1 to page2 directly, which
> Howard referred to as the "Tapestry Bucket Brigade" on the wiki :
>
> http://wiki.apache.org/jakarta-tapestry/MoreFrequentlyAskedQuestions
>
> In this scenario, though, we are accumulating info gradually over four
> or five pages.
>
> I still expected bucket brigade approach to work, but we are having a
> problem.  The scenario is:
>
> page1 form listener sets object on page2 directly, then calls
> cycle.activate on that page (works)
> page2 renders (works - object that was set from page1 still correct)
> page2 submits - at this point in the form listener for page2 my object
> is now null.
>
> I'm guessing that when page 2 submits, since that is a new http
> request, that I have no guarantee that the same instance of the page2
> class is being used from the pool, so it makes sense to me that I'm
> losing the reference to the object that was handed down from page1,
> but I was kind of hoping that tapestry would work some magic for me
> here ;-).
>
> We resolved the problem so far by making the property for the object
> on page2 persistent, but I'm not too happy about that.
>
> In Struts I might use a session-scoped form for something like this,
> and then of course you have to manage when the form gets pulled from
> the session if you don't want it hanging around until the session
> expires / is terminated.  I think that's pretty much the equivalent of
> using the persistent property to do this in Tapestry.
>
> I'm new to Tapestry, so I'm probably missing something obvious ;-).
>
> TIA,
> Jim
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


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