OTN's Servlet-based Surveys
Part 2 - Using the Survey Application
August 1999 |
 |
To build surveys and gather response data, OTN uses the Survey Application.
The steps are:
- Installing the Survey Application
-
Designing a Survey
-
Responding to a Survey
The figure below shows the flow and interaction for defining and responding to
surveys.
|
Definition
|
Response
|
-
Connect to the Survey Definition servlet (SD) and log in.
-
Use wizards to define a survey.
-
When you finish, the servlet writes your specifications to the survey structure
tables in the database.
|
-
Connect to the Survey Response servlet (SR) and specify a survey to respond
to.
-
The servlet reads data from the survey structure tables.
-
The servlet generates a dynamic HTML form.
-
Submit your answers. The servlet writes the data to the user response tables.
|
Designing a Survey
The Survey Application uses objects to represent a real-world survey: a Survey
object contains Question objects. Each Question presents the question text and
a ChoiceGroup object consisting of one or more Choice objects that represent user
responses.
To design a survey, use the Survey Design servlet and follow these steps:
-
Log in.
-
Define ChoiceGroups. Use existing Choices
or create Choices as needed.
-
Define Questions. For each Question, specify
question text, choose a ChoiceGroup of appropriate responses, then decide
how to present the choices to the user: as radio buttons, check boxes,
a list, or a text field for a freeform response.
-
Define Survey attributes such as fonts,
colors, and header and footer text.
The following steps show how to create a simple one-question survey. To
create a real survey, add more questions. The Survey Design servlet uses
the same interface to create and edit surveys, so it's easy to change,
customize, and maintain them.
To log in:
-
Connect to the Survey Design servlet. From your browser, enter a URL like
the following, but replace hostMachine with the name of the machine
that is hosting the servlet.
http://hostMachine:8888/servlet/SDServlet.SDSessionServlet
-
Log in. Choose a name from the list of existing users or type a name and
create a new user, then click Go to display the Survey Application
page.
To define a ChoiceGroup:
-
The Survey Application page displays a list of options. Click Choice
Groups to display the Create or Edit Choice Groups page.
-
Click the link to create a new Choice Group, which displays the Choice
Group Details page.
-
In the Choice Group Name field, type cgColors.
-
In the New Choice field, type red, then click Add to
Choice Group to add it to the list of choices.
-
Repeat the previous step to add the color names green and blue
to the list of choices.
-
Click Create Choice Group to commit the group and its choices.
To define a Question:
-
Click Questions to display the Create or Edit Question page.
-
Click the link to create a new Question, which displays the Create a New
Question page.
-
In the Name field, type qColor. The name identifies the
Question.
-
In the Label field, type What is your favorite color? The
label text appears in the survey.
-
To answer this question, the user chooses one item from a ChoiceGroup.
To specify this, click One of Many.
-
In the corresponding Question Format box, choose RadioGroup.
-
In the corresponding Choice Group box, choose cgColors.
-
In the corresponding Default Value box, choose red.
-
Click Create Question to commit your specifications.
To define Survey attributes:
-
Click Surveys to display the Create or Edit Survey page.
-
Click the link to create a Survey, which displays the Create New Survey
page. This page contains a wizard that presents several panels where you
define survey attributes. The first panel is the Enter Survey Details panel.
-
In the Survey Name field, type SimpleSurvey.
-
In the Submit Button Text field, type Submit.
-
In the Survey Title field, type A Very Simple Survey.
-
In the Header field, type Please answer the following question.
-
In the Footer field, type Thank you for responding to this survey.
-
Click the right-arrow at the bottom of the panel to display the Select
Questions for Survey panel.
-
From the Available Questions list, choose qColor, then
click the double right-arrow to add it to the Survey Contents list.
-
Click the Check Mark icon at the bottom of the panel to commit the definitions
and display the Completed Survey Definition panel.
-
Click Preview to display the survey, then click Finish to
save it to the database.
Responding to a Survey
Load the survey, answer the questions, then save your responses to the database.
- Connect to the Survey Response servlet. From your browser, enter a URL
in the following form:
http://<machineName>:<webServicePort>/servlet/SRServlet.SRSessionServlet?<parameters>
There are three servlet parameters, all mandatory:
- SURVEY_ID - Survey ID number.
- USER_ID - User ID (number or string) of the person responding to the
survey.
- RETURN_PAGE - URL of a page to display after survey responses are stored.
Examples:
http://scott-pc:8888/servlet/SRServlet.SRSessionServlet?SURVEY_ID=30&USER_ID=30&RETURN_PAGE=
http://Scott-PC:8888/servlet/SRServlet.SRSessionServlet?SURVEY_ID=30&USER_ID=rhall&RETURN_PAGE=
- Answer the survey questions.
- Click Submit to store your responses in the database.
Installing the Survey Application
Using the Survey Application
Analyzing Survey Results
How it Works
Questions or comments? Post a message in OTN's Sample Code discussion
forum or send email to the author.
Case Study: OTN's Servlet-based Surveys
Author: Robert Hall,
Oracle Corporation
Date: August 1999
This document is provided for information
purposes only and the information herein is subject to change without notice.
Please report any errors herein to Oracle Corporation. Oracle Corporation
does not provide any warranties covering and specifically disclaims any
liability in connection with this document.
Oracle is a registered trademark
and Enabling the Information Age is a trademark or registered trademark
of Oracle Corporation. All other company and product names mentioned are
used for identification purposes only and may be trademarks of their respective
owners.
Oracle Corporation
World Headquarters
500 Oracle Parkway
Redwood Shores, CA 94065
USA
Worldwide Inquiries:
+1.650.506.7200
Copyright © Oracle Corporation
1999
All Rights Reserved
|