Survey Sample

The survey sample shows you how to use an HTML form to:

  • Accept input from selection boxes, radio buttons, and text entry fields
  • Store the data
  • Display it

This sample requires a database to store the visitor comments. The database does not need any set-up. Refer to Configuration .

Run this sample

 


How this sample works:

This sample has:

  • An input form to enter data
  • A Java servlet that reads the input data, stores it in a bean, and calls the output page
  • Another Java servlet that queries the database and selects all the answers
  • A JavaBean that updates the database
  • A JavaServer Page (JSP) that returns a summary of your answers
  • Another JSP that displays all the answers
  • Two servlet files that provide information about the servlets to the WebSphere Application Server

This sample uses a relational database to store the survey data. It was created with the Studio Database wizard using the 'select and update' option.



How to use this sample on your web page:

To reuse this form, edit survey.html and change the text for our five survey questions and answers. Be sure to maintain the same data types for each question.

Or, you can follow this example to build your own form and create database tables to store your answers.