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


   

Creating Variables

In this section, you'll declare individual variables in your code file (Main.java) to hold the name, e-mail address, and comments entered by a single guest. Later on, you'll structure this information differently in order to work with data from multiple users.

WebObjects Builder allows you to declare variables without having to edit your source file directly. At the bottom of the panel there is a pull-down menu titled Edit Source. It has five items:


  1. Choose Add Key from the pull-down menu.

    The Add Variable/Method panel opens.

  2. Type guestName in the Name field.

  3. To specify the variable's type, select String from the combo box (or you can type String directly in the box).

  4. Click Add.

    You have just created a variable called guestName of type String. It appears in the first column of the object browser. A declaration for guestName also appears in Main.java, which you'll edit later.

  5. Create the variables email and comments in the same way (they are also of type String.)
Note:  You may also add variables by editing the source file in Project Builder. You will need to use Project Builder to remove or modify a variable. Remember to save the file after editing in Project Builder to update WebObjects Builder.


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