Using a repetition, Using a repetition 53 – Apple WebObjects 3.5 User Manual
Page 53

Using a Repetition
53
pageWithName
is a standard WebObjects method (defined in the
WebApplication class) that allows you to specify a new page to display.
At this point, the code for
Main.java
looks like this:
14. Save
Main.java
.
15. Build and run your application.
Each time you submit the form, the number of guests displayed in the
WOString should increase.
To return to the Main page, you’ll have to use your browser’s backtrack
button. Later in the tutorial, you’ll add a hyperlink to return to the
Main page.
Using a Repetition
You have demonstrated the use of a second component. Now you’ll create
a table to display the entire list of guests in the GuestList component. To
do so, you’ll use a dynamic element called a repetition (WORepetition).
Repetitions are one of the most important elements in WebObjects, since
it is quite common for applications to display repeated data (often from
databases) when the amount of data to be displayed isn’t known until
run time. Typically, a repetition is used to generate items in a list or a
browser, multiple rows in a table, or multiple tables.
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.