Re: How to create a session?
Re: How to create a session?
- Subject: Re: How to create a session?
- From: Nathan Dumar <email@hidden>
- Date: Fri, 28 May 2004 12:46:38 -0400
In the component (aka page), declare your new editing context in the
method ...
public componentName(WOContext context) {
super(context);
EOEditingContext ec = new EOEditingContext();
}
That way you have a new editing context every time this page loads
(does not create a new one when action methods return null and the same
page is reloaded).
In the actions that call different components than the one you're in,
do your dispose ...
public otherComponent goOther() {
otherComponent nextPage =
(otherComponent)pageWithName("otherComponent");
ec.dispose();
return nextPage;
}
It's safe to do it here because you won't be needing it (assuming the
next page has nothing to do with the current one). If the next page
does need it, then this is where you pass the variable to the next
page, and you can dispose later when leaving the pages that don't need
the editing context.
I have never tried disposing the default editing context. I have no
idea what would happen, or how you could get it back, if WO would even
let you do that.
If you're doing this to refresh data that may have changed, you'll need
to put both the declaration and the dispose in the method that gets the
data. Otherwise you'd have to leave the page and then return to it in
order to get updated data. (Assuming the page does not have the
ability to edit the data. If it does, you'll have to work out when to
create and when to dispose of the editing context.)
Nathan
On May 28, 2004, at 11:11 AM, john XUE wrote:
Hi folks,
After terminating a session,how do I create a new one
or recover the old one?
Thanks!
John
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
_______________________________________________
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.