Apple WebObjects 3.5 User Manual
Page 78
Chapter 5
WebObjects Viewed Through Its Classes
78
subscription for a friend. You follow the process a second time, selecting a
different publication and entering your friend’s address.
At this point, within a single session with the subscriptions application, you’ve
accessed the same pages twice, entering different information each time. Let’s
say that you now realize that you made a mistake in your own address, so you
backtrack to that page, change the address, and resubmit the information. It’s
important that the new address information is submitted to the customer
information page as it existed during the first order so that the revised
information can be associated with the right publication order.
WebObjects associates a different context ID (again, a randomly generated
integer—to maintain security) with each request-response loop cycle. A request
to a session includes both the name of request page and a context ID so the
session object can locate, from its cache of page instances, the appropriate one
to handle the request.
Assigning Input Values
At this point, the application, session, and component objects have been created
(if necessary) and awakened so that they are ready for the request. The next step
is to extract user-entered values and assign them to variables. Here is the basic
sequence of events in preparing for a request:
1. The application object sends
takeValuesFromRequest:inContext:
(in Java,
takeValuesFromRequest
) to itself; its implementation simply invokes the session
object’s
takeValuesFromRequest:inContext:
method.
2. The session sends the
takeValuesFromRequest:inContext:
message to the request
component.
3. The component, in its implementation of
takeValuesFromRequest:inContext:
, gets its
template and forwards the message to the template’s root object. A template
is an object graph that represents the static HTML elements, dynamic
HTML elements, and subcomponents that together compose the page
associated with a component instance.
4. All dynamic elements in the page template and in the templates of
subcomponents receive the
takeValuesFromRequest:inContext:
message. If one of
these elements “owns” a user-entered value, it responds to the message by
storing the value in the appropriate variable defined in the request
component’s declarations file.