Apple WebObjects 3.5 User Manual

Page 95

background image

Benefits of Reusable Components

95


World Wide Web Wisdom, Inc.


Please come visit us again!




The thirteen lines are reduced to one, which positions the WebObject
named NAVCONTROL. The declarations file for this page binds the
WebObject named NAVCONTROL to the component named
NavigationControl:

NAVCONTROL: NavigationControl {};

All of the application’s pages would have entries identical to these in their
template and declarations files.

NavigationControl is a component that’s defined once, for the use of all of
the application’s pages. Its definition is found in the directory

NavigationControl.wo

in the file

NavigationControl.html

and contains the HTML for the

table:








World Wide Web Wisdom, Inc.
Home Sales Service Search

Since NavigationControl defines a group of static elements, no declaration
or code file is needed. However, a reusable component could just as well be
associated with complex, dynamically determined behavior, as defined in
an associated code file.

Now, to change the navigational control on all of the pages in this
application, you simply change the NavigationControl component. What’s
more, since reusable components can be shared by multiple applications,