beautypg.com

Implementing an action method, Implementing an action method 30 – Apple WebObjects 3.5 User Manual

Page 30

background image

Chapter 1

Creating a Simple WebObjects Application

30

The Inspector window comes to the front, displaying the bindings for the
text area. The

value

attribute is automatically selected (since that is the one

that is most commonly used in bindings). If you wanted to choose a
different attribute to bind (you don’t at this time), you would simply select
the binding of your choice.

2. Click Connect Variable.

comments

appears in the Binding column next to the

value

attribute of the text

area, indicating that the binding has been made. Also, the text

comments

appears in the text field to show that it has been bound.

Note:

you can also bind a variable by typing its name directly in the Binding

column for the desired attribute.

3. In the same way, bind the

guestName

and

email

variables to the two text fields.

4. Save the Main component.

Implementing an Action Method

When the user clicks the Submit button, your application will respond by
redisplaying the page with the submitted information shown at the bottom. To
make this happen, you implement an action method and bind that method to the

action

attribute of the WOSubmitButton.

1. From the Edit Main.java menu at the bottom of the object browser, choose

Add Action.

2. Enter

submit

as the name of your action method.

Enter action name here.

Select response page name from
pop-up menu (use null to return
same page).