Documentation Archive Developer
Search
Table of Contents Previous Section

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.

  3. From the "Page returned" pop-up menu, select null.

    The value returned by an action method represents the next page (component) to be displayed. When you return null (or nil if using WebScript), the current page is redrawn. In a later task, you'll see how to return a new component.

  4. Click Add.

    The submit action appears below a horizontal line in the first column of the object browser.

  5. Click submit in the object browser and drag the cursor to the submit button.

    The Inspector opens with the button's action attribute selected.

  6. Click Connect Variable.

    You just bound the submit method you created to the action attribute of the WOSubmitButton. You don't need to write any additional code, so your application is now ready to run. However, you may want to look at your source file.

  7. From the pull-down menu at the bottom of the window, choose View Source File.

    Project Builder becomes active and displays the code for your component (in Main.java). You'll notice that this file contains declarations for the variables you created earlier, as well as a declaration for the submit action method.

Table of Contents Next Section