Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > Getting Started With WebObjects


   

Adding Guests to the Guest List

Now, when the user submits the form, you'll add the information to the allGuests array rather than displaying it directly.

  1. Switch to the code for Main.java.

  2. In the submit method, add the following code before the return statement:

    ((Application)application()).addGuest(currentGuest);
    currentGuest = new Guest();

    This code calls the application's addGuest method, which adds an object (in this case, currentGuest) to the end of the array. Then it creates a new Guest object to hold the next guest's data.

    Note: The addGuest method is defined in the class Application, which is a subclass of WOApplication. The component's application method (called in the above statement) returns an object of type WOApplication, so you must cast it to Application in order to access its addGuest method.

Your next step is to create a new component to display the list of guests that allGuests stores.


© 1999 Apple Computer, Inc. – (Last Updated 24 Aug 99)