Table of Contents
Previous Section
This section uses the Registration application to describe how you integrate compiled Objective-C code into a WebObjects application.
The Registration application takes information about a user as input, validates it, and writes it out to a file. The first page of the application is shown in Figure 1.
Figure 1. The Registration Application
The Registration application includes these files:
- Registration.m
- Defines the main() function, which creates autorelease pool,adaptor, and application objects.
- Person.[hm]
- A custom Objective-C class whose primary function is to validate data entered by users.
- RegistrationManager.[hm]
- A custom Objective-C class whose primary functions are to register new users by writing their data to the People.array file and to return an array of all registrants.
- People.array
- A file that contains data about registrants in a property list format.
- Application.wos
- The application script. It creates and maintains a RegistrationManager object as a global variable.
- Main.wos
- The script for the application's first page. Main.wos has an associated declarations file (Main.wod) and HTML template (Main.html).
- Registrants.wos
- The script for the application's Registrants page, which lists all of the registered people. Registrants.wos has an associated declarations file (Registrants.wod) and HTML template (Registrants.html).
The scripted components Main and Registrants contain the application's interface logic. Main.wos includes methods for capturing user input and clearing the forms on the first page. Registrants.wos has just an awake method in which it retrieves data for display. The Person and RegistrationManager classes, on the other hand, contain the application's business logic. They validate user input and manage the application's data.
Table of Contents
Next Section