Re: Sava a page in session
Re: Sava a page in session
- Subject: Re: Sava a page in session
- From: email@hidden
- Date: Tue, 25 Nov 2003 18:12:18 CDT
- Priority: 3 (Normal)
[demime could not interpret encoding binary - treating as plain text]
Those aren't 'bad' ways; those are pretty much the only ways!
Sure, there are more complicated/powerful ways of doing similar things.
Take a look at D2W's NextPageDelegate interface and how it's used for the
basic idea of a more flexible and powerful (but somewhat more
complicated) way of doing it.
But the ways Ray suggests are perfectly fine and reasonable basic ways of
doing it, that will work until you need something fancy for something
more complicated. I would also agree with Ray about when to put the data
in the session vs not. Unless the page instance truly is session-relevant
data, don't put it in the session, generally. Might any arbitrary page
in the session need to access this WOComponent instance, and find this
WOComponent instance meaningful? If so, put it in session. But if it's
really just that next page that will need and find meaningful this data,
don't go through the Session, just pass it from page to page and leave
your session uncluttered.
--Jonathan
On Wed, 26 Nov 2003 10:13:36 +1300 Ray Ackland wrote:
> Kranthi,
>
> There are several ways of doing this. Chances are I am going to tell
> you the "bad" ways, but others will jump in and suggest more correct
> alternatives.
>
> Method one is to create session objects (ones defined in your session
> class) to store this information. You can then access and set these
> from any of your pages. I would say to do this only if the information
> really is related to a session (something that you want to have
> globally available to all/most pages while that user is active.
>
> Second option is to pass the data between pages. You can do this by the
> following (skeleton help here):
> In page A, have the data stored in local variables. In page B & C have
> accessor methods and variables to hold a page object. When you are
> ready to move on to page B, create it using pageWithName("B") and then
> call setOriginalPage(A) - or whatever you called the accessor method
> you created - before returning page B. This means that the new page B
> will keep a reference to your first page A.
>
> Do the same thing for travelling from B->C, passing page B to C. When
> you want to return to B (and subsequently to A) instead of creating a
> new page, just return the one stored in the variable. C will return the
> B that you were previously in, and this B will hold and return the
> original page A.
>
> You should then have all your information they had previously entered.
>
> Anyone else got other suggestions?
>
> Ray.
>
> On Wednesday, Nov 26, 2003, at 04:13 Pacific/Auckland, Kranthi Sagar
> Borra wrote:
>
> > I have a page A in which I enter few fields but will not save, instead
> > I will click on a button which will take me to a page B.I shall do
> > some transactions here which will load another page C and finally come
> > back to page B.Now I need to go from page B to page A on click of a
> > button/link.But now I cannot load page A by calling the method
> > "pageWithName("A");" , this will reload my entire page "A" again and I
> > will loose any information that I entered in "A" before.So is there
> > any way by which I can store the page "A" in some session/cache and
> > reload it again when i click on the link.Thanks in advance.
> _______________________________________________
> webobjects-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.