
Chapter 1 Creating a Simple WebObjects Application
28
WebObjects Builder allows you to declare variables without having to edit your
source file directly. At the bottom of the window there is a pull-down menu
called Edit Main.java. It has three items:
•
Add Variable/Method allows you to add a key to your source file. A key can be either
an instance variable or a method that returns a value.
•
Add Action allows you to add the template for an action method, which is a
method that takes no parameters and returns a component (the next page
to be displayed).
•
View Source File opens the source file in a Project Builder window.
1. Choose Add Variable/Method 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 pop-up menu (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.)
Type variable name here.
Choose variable’s type from
this pop-up menu.
Comentarios a estos manuales