Lab 6 - Developing A Servlet Using HTML Forms
Lab 6 - Developing A Servlet Using HTML Forms
Materials:
PC with Java SDK and JCreator installed.
PC with J2EE 1.3 installed
PC with Apache Tomcat installed and configured
Case Problem: The owners of Goodwill Bookstore are considering developing a Web site for online book
buying. They want to survey college students to find out whether Internet shopping is feasible for their
products. They want you to create a Web page that contains the question as shown in the figure below.
Instructions:
1. Start a new HTML file survey.html using JCreator. In the title tag, write ’Lab 6 - Devloping
Servlet Using HTML Forms’.
2. Begin the form processing structure by using the POST method with the ACTION attribute set to
/servlet/adprog1.web.BookstoreSurvey.
3. Create a H1 heading for the title.
4. Insert in the first row text fields for first name, last name and email address. Refer to the table
below for the attribute values.
5. Insert in the second row a text field for an address. Refer to the table below for the attribute values.
6. Insert in the third row text fields to contain city, country and ZIP code. Refer to the table below for
the attribute values.
7. Create radio buttons for the next survey question. Refer to the table below for the attribute values.
8. In the next row create a selection menu with the first option (Goodwill Bookstore) plus three other
options. Refer to the table below for the attribute values.
9. Insert a second radio button for the next question. Refer to the table below for the attribute values.
10. Specify a five-row, 75-column text area field for the input. Refer to the table below for the attribute
values.
11. Create Submit and Reset buttons at the bottom of the Web page form.
12. Save the file.
No
Question 4 TextArea question4 (none)
Submit Button Submit Submit
Reset Button Reset Reset
1. Write the BookstoreSurvey servlet program that will retrieve form data and create an on-the-fly
HTML page that displays the contents in a table.
2. The sample response should look like the one shown in Figure 1.
http://localhost:8080/survey.html
4. Enter data and click the Submit button. The servlet should respond and displays the form data in a
table (see sample output below).
Firstname: Allan
Lastname: Abulencia
Email: [email protected]
Address: Smart Tower, Ayala Ave., Makati City
City: Makati
Country: Philippines
Zip Code: 1020
Question 1: Yes