Up

Creating Reusable Components

As you've seen in previous chapters, a WebObjects application comprises a number of components. Each component is represented in the file system as a directory (for example, MyComponent.wo) that stores the component's template, declarations, and script files (MyComponent.html, MyComponent.wod, and MyComponent.wos, respectively) as well as other resource files. In the simplest applications, each component corresponds to an HTML page, and no two applications share components. However, one of the strengths of the WebObjects' architecture is its support of reusable components: components which once defined, can be used within multiple applications, multiple pages of the same application, or even multiple sections of the same page.

This chapter describes reusable components and shows you how to take advantage of them in your applications. Its main sections are:

Benefits of Reusable Components

Reusable components benefit you in two fundamental ways. They help you:


Intercomponent Communication

A reusable component can be nested within a page or within another reusable component. This section discusses how data and actions can be communicated between these levels.

Search Path for Reusable Components

At run time, WebObjects follows a set path to find reusable components. This section lists the places it looks.

Designing for Reusability

This section discusses the issues involved in designing for reusability:


Table of Contents Next Section