Table of Contents Previous Section

Writing HelloWorld

Writing a WebObjects application involves creating a component for each page in the application and installing the components in a directory that's accessible to WebObjects and your web server. Using HelloWorld as an example, this section explains how to perform these tasks. As an additional reference, the source code for HelloWorld is located in NextLibrary/WebObjects/Examples.

HelloWorld

The HelloWorld application consists of two pages. Figure 9 shows the first page.

Figure 9. The First Page of HelloWorld

The presentation may vary slightly from browser to browser, but the page elements are the same regardless. The first page contains a single input field in which you type your name. Clicking Submit opens a new page with a personalized greeting. For instance, typing "Joe" and clicking Submit opens a page similar to the one in Figure 10.

Figure 10. The Second Page of HelloWorld

The HelloWorld application has three simple requirements: get the name that's entered in the input field, dynamically generate the HTML required to display the message in the second page, and open the second page when Submit is clicked. More generally:

HelloWorld has two components---Main and Hello. The following sections describe the files for the Main and Hello components of the HelloWorld application.

 

Table of Contents Next Section