WebObjects/Web Applications/Development/Direct Actions

Overview
Direct Actions are action methods that can be called without a WOSession. As opposed to Component Actions, where a WOSession is required and various form values are bound as objects, Direct Actions perform much more like traditional web frameworks where the form values are accessed via WORequest's formValues dictionary and cookies. Direct Actions are very useful for building stateless, high-performing websites, though you lose some of the easy-of-development that WebObjects provides with Component Actions.

Pages are still generated in the usual way, but if you want the links generated in the page to employ Direct Actions when clicked, ie. to create Direct Action URLs, you must make appropriate bindings.

Direct Actions can be used in conjunction with Sessions if desired, in much the same way that Sessions work with other web technologies - the correct Session object will be located automatically from information in the URL or in a cookie, and state can be obtained and altered in it.

Among other things, Direct Actions are typically used if no Session whatsoever is desired (uses less resource), or if bookmarkable or easily created URLs are required. DirectActions are also often used to provide multiple entry points to your application, each with it's own URL---but then subsequently returning components that use the ordinary Component Actions.

Direct Actions would also be good to use if you don't need the additional convenience of the Component Actions, simply because they come without any of its disadvantages. However, it's quite difficult to create a whole WO application without creating a WOSession and most of the time, you're going to need it anyway.

David LeBer's Articles
David LeBer has a great series of articles on using Direct Actions:


 * 1) Using WebObjects DirectActions pt. 1
 * 2) Using WebObjects DirectActions pt. 2
 * 3) Calling a DirectAction with values from a form
 * 4) Calling a DirectAction with values from a WOHyperlink
 * 5) Calling a DirectAction with values from a WORedirect