Documentation Archive Developer
Search
PATH Documentation > WebObjects

PreviousNext 

User Templates

Sometimes you need to change the appearance of a Direct to Web page without freezing the component. You might want to change all of the pages for a particular task (list pages for example) without freezing components for every entity. Or you might want to use the Web Assistant to fine-tune pages having your custom appearance.

Direct to Web allows you to generate, modify, and use templates. Templates are WebObjects components that Direct to Web can use to generate pages (list pages for example) for any entity. Direct to Web provides a number of prebuilt templates from which you generate user templates. User templates appear together with the prebuilt templates in the Web Assistant and you can apply them to pages in your project.

These are the advantages of using templates:

Templates are slower than frozen components since Direct to Web generates the pages that the user sees in the browser.

Generating a Template

Follow these steps to generate a template:

  1. Click Expert Mode at the bottom of the Web Assistant window to enter Expert mode.
  2. Click the Generation tab at the top of the WebAssistant. [image: ../Art/wageneratetemplate.gif]
  3. Select the task corresponding to the page you want to generate.
  4. Select "*all*" in the Entities pop-up list.

    You must select "*all*" for the entities because the template is independent of the entity. You cannot select "*all*" for the task to generate multiple templates. You must generate the templates one at a time.

  5. Make sure the "Use DirectToWeb or User Template" radio button is selected.
  6. Click Generate Template.

    The Generate Template window appears. It contains a text field with a default name for your template. You can edit the name if you choose.

  7. Click the Ok button.

    Direct to Web copies a component (with extension .wo) and a corresponding .java file from a predefined template and adds them to your project. You may have to wait a few moments for this process to complete. Your settings are automatically saved.

  8. Rebuild and run your project, and restart the WebAssistant.

After you generate the template and rebuild your project, you can use the Web Assistant to apply the template to a Direct to Web page. See "Customizing Pages".


PreviousNext 

© 2001 Apple Computer, Inc.