PATH  WebObjects 4.0 Documentation > What's New in WebObjects 4.0

Table of Contents Previous Section

How Direct Action Requests Are Sent

Dynamic elements that have an action attribute are bound to component actions. Dynamic elements that have a directActionName attribute are bound to direct actions. The list of dynamic elements bound to direct actions includes WOActiveImage, WOForm, WOFrame, WOHyperlink, WOImageButton, and WOSubmitButton.

When you create a WebObjectsApplication project in release 4.0, a subclass of WODirectAction (a new class in WebObjects 4.0 that is a container for action methods) named "DirectAction" is created for you (along with the WOApplication subclass named "Application" and the WOSession subclass named "Session"). "DirectAction" is the default name for a WODirectAction subclass, and can be renamed if you prefer. You can create several WODirectAction subclasses each performing a single action or a set of actions, or you can have a single WODirectAction subclass perform all of the actions.

For example, the declaration for a WOHyperlink that triggers a direct action might look like this:

myLink: WOHyperlink {
	actionClass = "MyActions";
	directActionName = "logout";
}
The actionClass parameter specifies a subclass of WODirectAction (it defaults to "DirectAction" if omitted). The directActionName should refer to an action name; if omitted, WebObjects invokes the method defaultAction within the specified class. Method names are derived from action names by appending "Action" to the action name; thus, a directActionName of "logout" corresponds to the logoutAction method.

Table of Contents Next Section