Example 1: An Anonymous Survey

Our first application will let users fill out anonymous surveys using a web browser. Surveys and opinion polls are some of the most common web applications, and usually consist of a list of questions. Users respond by selecting an answer from a small list of options. Most systems also have an option that lets users see the tabulated results for each survey.

This section walks through a simple process you can use to create a generic survey system. Our first step is to design a storyboard to define each screen in the system. This sketch helps us in the next step: designing a generic data model that we can use to construct each page. Our last step is to actually code the system.

Storyboard

In a typical survey application, the first screen presents a list of all available surveys. There are usually two options for each survey: to answer it or to view its tabulated results. If the user decides to answer a survey, she’s presented with a bunch of questions and a corresponding list of possible answers. She then answers the questions and presses “Submit” to save the responses in a database table. If the user chooses to view the results of a survey, she’s presented with a table summarizing all the previous responses. Figure 8.2 is a simple storyboard that captures these functions.

The storyboard for the anonymous survey

Figure 8-2. The storyboard for the anonymous survey

Data Model

We can use the storyboard ...

Get Oracle Web Applications: PL/SQL Developer's Intro now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.