Documentation Archive Developer
Search
Table of Contents Previous Section

Sharing Reusable Components Across Applications

If a component is in the WebObjects application's directory, it can be used over and over again, but only within that application. This may be fine for some components, but others, you'll want the option to reuse in many applications. If a component is packaged in a framework, it can be used in any WebObjects application.

To package components in a framework for reuse by several applications, do the following:

  1. Create a project in Project Builder of type WebObjectsFramework.

  2. Add to this project (under Web Components) all of the components that you want to share across applications.

  3. Add any resources needed by the components. If the HTTP server needs access to the resource (which is the case for image files and any file that will ultimately be referenced in the HTML file), add it under WebServerResources. Otherwise, add it under Resources.

  4. Build the framework. If you perform a make install, it installs the framework in NeXT_ROOT/NextLibrary/Frameworks and the WebServer resources in <DocRoot>/WebObjects/Frameworks.

    You must build the framework even if it contains only scripted components.

After the framework is installed, you need to set up the applications so that they can use components in that framework. Do the following:

  1. In Project Builder, add the framework to the application's project under Frameworks.

  2. Build the application.

    The application's executable file must contain all components that your application references, as described in the next section. For this reason, you must build the application even if it contains only scripted components.

Table of Contents Next Section