Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > Tools and Techniques

   

Reusable Components

One of the strengths of the WebObjects architecture is its support of reusable components. Any component that you define, whether it represents an entire page or part of a page, can be reused by any WebObjects application. A component can be used in multiple pages or even multiple times in the same page. Reusable components can be used for such items as headers, footers, and navigation bars.

When a reusable component is used inside another component, it is referred to as a child component ; the containing component is called the parent component .

To reuse a component, you can either:

See Frameworks for information on creating frameworks and adding them to a project. To add a component directly to a project, you can:

A component that is designed for reuse can export keys and actions, which become attributes that the parent component can bind, just as it would set the attributes of any other dynamic element. When the component is added to a parent component, these attributes show up in the Custom WebObject Inspector. The attributes must be enumerated using the API Editor for the component.

The Inspector shows the child component's attributes. As with any other dynamic element, you can bind the child component's attributes to keys and actions in the parent component's code.

Note: When you create a component that is specifically designed to be used within other pages, specify "Partial document" in the Page Attributes Inspector pop-up list (see Setting Page Attributes ). This way WebObjects Builder does not wrap <HTML>, <HEAD>, and <BODY> tags around your component.

For more information, see "Reusable Components" in the WebObjects Developer's Guide .


© 1999 Apple Computer, Inc. – (Last Updated July 27 99)