You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mirko Viviani <mi...@e-cremona.it> on 2004/02/10 12:49:31 UTC

Problems accessing visit object

Imagine this simple scenario:

PageA is a simple page with an action
PageB does some computation

PageA-action() get an instance of PageB and call a method (doesSomething())
that initialize the page properly.

action(cycle) {
   pageB = cycle.getPage("PageB");
   pageB.doesSomething();
   cycle.activatePage(pageB);
}

PageB-doesSomething() needs to access some data in the Visit object to
initialize some variables. (ie the user's preferences)

doesSomething() {
   Visit visit = getVisit();

   visit.getSomething();
   compute();
}

or:

initialize() {
   visit = getVisit();
}

doesSomething() {
   visit.getSomething();
   compute();
}

The Visit object is not available in initialize() method of PageB but only
from pageBeginRender() that is not called before doesSomething() so I can't
access it properties and start the computation.

In the real world PageB has many doesSomething() methods that does different
things so what to do?

Is there a way to do this? (something that does not force me to pass the visit
object from PageA to PageB!)

In WebObjects this works perfectly because in the -awake (initialize) method I
can access the Session (Visit) and Application (Global) objects as it should be...

The same thing could be applied to persistence properties since I think (but I
haven't actually tested it) I can't set them in doesSomething() and in
initialize() (this one tested).

3.0-beta-4

Thanks.

Ciao
Mirko


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