Invoking an action – Apple WebObjects 3.5 User Manual

Page 79

Advertising
background image

How WebObjects Works—A Class Perspective

79

For more on how components are associated with templates, and on how
HTML elements participate in request-handling, see “How HTML Pages
Are Generated” (page 82).

Invoking an Action

In the second phase of the request-response loop (see Figure 23), the
application first determines which dynamic element the user has clicked (or
otherwise activated) and then has that element trigger the appropriate
action method in the request component. This method returns the response
page
—the component responsible for generating an HTTP response. If the
user has not triggered an action, the request component is used as the
response component.

Figure 23. Invoking an Action

Here is the basic sequence of events for invoking an action:

1. The application object sends

invokeActionForRequest:inContext:

(in Java,

invokeAction

) to itself; its implementation simply invokes the session

object’s

invokeActionForRequest:inContext:

method.

2. The session sends

invokeActionForRequest:inContext:

to the request component.

3. The component, in its implementation of

invokeActionForRequest:inContext:

,

gets the template of the component and forwards the message to the
template’s root object.

4. Suitable dynamic elements in the request-page template and in

subcomponent templates handle the

invokeActionForRequest:inContext:

Application

Session

Request Page

Page Template

invokeActionFor
Request:inContext:

invokeActionFor
Request:inContext:

Gets request page
and stores reference
to it.

invokeActionFor
Request:inContext:

Gets template for
component

Target dynamic
element responds by
returning value of
action.

Invokes action
method, which returns
component of
response page.

response page

invokeActionFor
Request:inContext:

Advertising