[Seaside] seside 2.5a questions

radoslav hodnicak rh at 4096.sk
Mon Apr 19 17:19:37 CEST 2004

On Mon, 19 Apr 2004, ld wrote:

> I'm learning seaside, starting with Version 2.5a.  It seems the best way
> to learn is to ask questions, so here goes:
> 1) WACounter initialization.  What does
>        registerObjectForBacktracking: self.
> actually do?

When you register an object for backtracking (or wrap it into
WAStateHolder) the engine keeps a (shallow) copy of the object as it was
in every "step" (request/response) of the application. This allows for
correct behavior when the browser's back button is used. The counter is a
simple and effective example of it:

the number in ( ) represents the value of the 'count' inst var in your
WACounter instance. '+' means you pressed the ++ link, '->' means next
page in browser.

(0)+ -> (1)+ -> (2)+ -> (3)
 A       B       C       D

I've started the counter example and pressed ++ 3 times (step D).
The counter now displays 3 and this is also the value of the instvar

Now I hit the back button twice - I see 1 displayed, but the instvar still
has the value 3. If there was no backtracking and I would click on ++ link
again, I would get 4 - which is both confusing and incorrect (comment out
the registerForBacktracking: in initialize and try it yourself).

However, with backtracking the engine sees "this is an action from the
step B" and restores all registered objects to the state they had when I
was on B the first time. The instvar 'count' has now the value 1 and ++
gives 2 again. Neat, huh?


The ID of where (step) you are in an application is one of the URL
parameters (was part of URL before).

There is some limit of how many back copies of every object are kept, I
think 10?

Only objects registered for backtracking (or put into WAStateHolder)
behave like this.

The rest of the questions is 2.5 specific so I'll leave that to seaside

Regards, radoslav
pgp.mit.edu  0x30DEBAE6  12EE FED5 D5B1 77ED 5637 EB77 2A5F 22F9 30DE BAE6

More information about the Seaside mailing list