Direct Actions are easier

Direct Actions are easier to use than regular actions because you can setup your application so that they don’t require any new code. Component actions require a method per action, which gets tedious quick.

Override performActionNamed() in your DirectAction class to map action names over to pageWithName(), then pull the values out of the request and shove them into the page using takeValueForKey(). Remember that the values coming in from the request are always strings, and all you need add to the page are accessors like setValueS() that convert the strings and store them in their proper place.

If you add those accessors to a common superclass for all your pages, you only need write them once. 

After that, you can define a hyperlink to a page directly from the .wod file. directActionName becomes the page name, and you can simply add ?valueS=value for each parameter the page needs.


Copyright 2007, Pierce T. Wetter III