beautypg.com

Adding a second component, Adding a second component 51 – Apple WebObjects 3.5 User Manual

Page 51

background image

Adding a Second Component

51

Adding a Second Component

In this section, you’ll create a new component. Instead of Java, you’ll
implement its code using WebScript.

1. In Project Builder’s browser, click Web Components in the first column.

2. Choose File

m

New in Project.

Note that the Web Components suitcase is selected.

3. Type

GuestList

as the name of the new component. Then click OK.

The WebObjects Component Wizard appears.

4. Choose None for Available Assistance and WebScript for Component

Language.

5. Click Finish.

6. In the second column of the browser, click

GuestList.wo

.

Note that there is an additional file you didn’t have with your Java
component.

GuestList.wos

is your script file, the WebScript equivalent of

Main.java

in the Main component. For WebScript components, the script

files are stored under the component, rather than in the Classes
bucket. You’ll add code to your script file in a later step.

7. Double-click

GuestList.wo

to bring up the component window in

WebObjects Builder.

8. Create a heading for this page, as you did for the Main component. Call

it “Guest List” (or something else of your choosing). Then press Enter
twice.

9. Add a WOString below the heading. Then type the text “

guests

have signed this guestbook

.”

You’re going to bind this WOString so that it reflects the number of
guests who have submitted this form.