Table of Contents Previous Section

Search Path for Reusable Components

When WebObjects encounters the name of a reusable component at run time:

NAVCONTROL: NavigationControl {};

it must find a WOComponent object to represent the component and then find the component's resources (HTML template file, image files, etc.).

To find an object to represent the component, WebObjects looks in the Objective-C run time for a subclass of WOComponent with the same name as the component ("NavigationControl" in the example above). For compiled reusable components this search should succeed, but for scripted ones it should fail. For scripted components, WebObjects provides its own private subclass of WOComponent.

Next, WebObjects looks within the application directory for the reusable component's resources. For example, if you manually start an application that resides in Doc_Root/WebObjects/MyWOApps/Fortune.woa, the Fortune.woa directory will be searched.

WebObjects pages and reusable components can be located in subdirectories within the application directory. For example, assuming you use different navigation controls for different parts of your application, you might specify the navigation control for your application's catalog pages as:

NAVCONTROL: CatalogPages/ReusableComponents/NavigationControl {};

This causes WebObjects to search the application directory's CatalogPages/ReusableComponents subdirectory for the NavigationControl's resources. You'll find that grouping reusable components within subdirectories like this helps keep your application directories organized.

Table of Contents Next Section