Table of Contents
Previous Section
When a WebObjects application receives a request from a WebObjects adaptor, it processes the request in three phases. As shown in Figure 13, the application uses the page-to-component mappings defined in the declarations files to:
The following sections describes what happens during each phase.
The application prepares for the request by updating variables in the request page---the page from which the request was made. If a user has provided any input that maps to a component variable, the application assigns the new value to the variable. For example, recall what happens when a user clicks Submit in the first page of HelloWorld: the application gets the value from the NAME_FIELD text field and assigns it to the nameString variable defined in the Main component.
After preparing for the request, the application determines whether or not the user has triggered an action. If an action has been triggered---for example, if the user clicked a button or a hyperlink---the application invokes the action method that corresponds to what the user did. For example, clicking Submit in HelloWorld has the effect of invoking the sayHello action method. An action method returns an object to represent the response page---the page that is sent back to the web server. sayHello returns an object to represent the Hello page. If the user does not trigger an action, the object representing the request page also represents the response page.
It is the responsibility of the response page object to generate the HTML for the response. Using the HTML template and declarations file, a component generates the HTML that is eventually displayed in the user's web browser. For example, after Submit is clicked in HelloWorld and sayHello returns an object to represent the Hello page, the Hello page object generates the resulting personalized greeting.