



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions for completing assignment 8 in the internet programming i course, which involves creating an html form and a java program to collect data from the form and send it to a server. The server processes the data and sends the result back to the user. The document also includes instructions for downloading and running a simple server, webserver, and explains how the server processes the form data.
Typology: Assignments
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Internet Programming I Assignment 8 Html forms and Java programs Due: November 7, 2006 One of the principle uses of programming on a web page is to collect data from an Html form and send it to the server. Once the data is there, it can be used in several ways. The server can compute something and send the result back to the user, or it can use the data to query a database. We will see examples of computations first. The ninth assignment will be used to query a database.
Test Data
Hello. Your name is Alice Lee Your email address is [email protected]
String name = request.getParameter ("name"); String email = request.getParameter ("email"); are used to bring this information into the program.
E-Mail Form
Enter your name and e-mail address.
Then click the Send button to send the data to the server.
See the results.
Name
E-Mail Address
The Java program uses a request to get the data from the form. The line, String name = request.getParameter ("email "); receives the data entered into the box called email in the form. It comes from the line
E-Mail Address
It is very important that the parameter in name="email" be exactly the same as that in request.getParameter ("email "); Since Java is case sensitive, a serious error is to use different cases in the two places.Now change both the program and the form to add a box for a telephone number. Insert another input statement into the form to produce the third box.
Telephone
Then save the changed file.Next insert two new lines into the program, one to get the new data item and the other to display it. The line that gets the data will read String phone = request.getParameter ("phone"); The line that displays it will be something like out.println ("Your telephone number is " + phone + ""); Note that all three places use the word, phone, and not some modification of it. You should be able to tell where these lines go in the program by looking at the other lines there.
Now start over with a new form and a new program. This time the form should have boxes for the width and height of a rectangle. You can copy the EmailForm into the new Html file and change several lines. The first line to change is the one with the form tag. It must have the name of the Java program that will process this request. If you call that program AreaProcessor, the form tag becomes
You should also change the lines that tell the user what to do. Enter your width and height of a rectangle. Also both input lines that define the boxes have to be changed. They become
Width
Height
Save this form with a name such as AreaForm.html.