A repetition can contain any other elements, either static HTML or dynamic WebObjects elements. In the GuestList component, you'll create a repetition that contains a table row.
You'll bind the allGuests array to the WORepetition's list attribute. This tells WebObjects to generate the elements in the repetition once for each item in the array. Each time WebObjects iterates through the array, it sets the repetition's item attribute to the current array object. You bind item to the variable currentGuest and use currentGuest's fields to bind the elements inside the repetition (such as WOStrings). At run time, the table will consist of one row (displaying name, e-mail address, and comments) for each guest.
You have just copied the table from Main into GuestList. It has all the same properties, including the bindings. The WOStrings in the table are still bound to instance variables of currentGuest. Since currentGuest is a component variable defined in Main, it isn't accessible from GuestList. Therefore, you need to declare it here.
When you wrap a repetition around a table row in this way, the WORepetition symbol doesn't appear in the table. Instead, a blue border appears around the row. For additional examples of using repetitions, see "Creating a WebObjects Database Application".
The Inspector window opens showing the repetition's bindings. The list attribute is selected by default.
To do this, you can select the row for item, then double-click in the Binding column and type currentGuest.
By using the name currentGuest for the item attribute, you are taking advantage of the fact that the strings in your table are already bound to the fields of currentGuest.
You now have finished implementing the repetition. When the table is generated, it will have one row for each item in the allGuests array.
Table of Contents Next Section