On Thursday, November 27, 2003, at 06:43 AM, Greg Hulands wrote:
The way I will update the WO app would be something like
/MyApp.woa/wa/setTitleForImage?image=uniqueImageNumber&title=newtitle.
Questions:
1. How do I get the session with a direct action as I need to get the
default editing context to update the database.
If you do need to access the session from within a direct action, it's
quite easy. Just call the session() method. If a session doesn't
already exist, this will create a new one.
However, you don't necessarily need to use the default editing context
just to do an update to the database. If you'd like to ensure that your
direct actions do remain stateless, just create a new editing context
in the direct action, fetch the EO that you want to update, make the
save, and change. Peer editing contexts are really handy for this sort
of thing.
2. How do I parse passed in parameters to the direct action, eg image
and title in the above example.
The parameters are stored as form values in the request. Simply call
context().request().formValueForKey(String formKey);
Colin
_______________________________________________
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.