Fundamentals of CS I (CS151 2002F)

More CGI

This lab is a little bit rougher than most.

Exercises

Exercise 0: Preparation

Make copies of the following files:

Start DrScheme.

Exercise 1: A Different CGI Library

a. Compare greeting1.ss to greeting.ss. How do they differ? How are they similar? Where do you think all the extra code that was in greeting.ss went?

b. Look at webutils.ss and summarize the purpose of the various procedures in that library.

c. Create a form (greeting1.html) and CGI file (greeting1.cgi) for greeting1.ss to test it.

Exercise 2: Generating Forms

While we've been creating our HTML forms in a text editor, it is also possible to generate a form with a CGI script.

a. Look at greeting-form.ss and see if you can figure out what it does.

b. Create a corresponding CGI file greeting-form.cgi, but don't create a corresponding HTML file. Load the CGI file in your browser and see what happens.

Exercise 3: Combining Ideas

a. Look at greeting2.ss and see if you can figure out what it does.

b. Create a corresponding CGI file, load it in your browser, and see what it does.

Exercise 4: Working with Numbers

Write a CGI script that takes a number as input and produces the square root of that number as output. Since CGI variables are passed as strings, you will probably want to use the string->number and number->string procedurese to convert to and from numbers.

 

History

Wednesday, 18 September 2002 [Samuel A. Rebelsky]

 

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Mon Dec 2 09:19:03 2002.
The source to the document was last modified on Wed Sep 18 08:45:56 2002.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2002F/Labs/more-cgi.html.

You may wish to validate this document's HTML ; Valid CSS! ; Check with Bobby

Samuel A. Rebelsky, rebelsky@grinnell.edu