60
CHAPTER 4. SCHEME SERVLETS
There are three main HTML elements for getting input from the user: input,
select, and textarea. Each of these elements must have a name parameter
which gives a name to the data that is sent to the server. The server will then
use this name to determine how to handle the data.
The input element The input element has several variants including check
boxes, textfields, and file browers. We describe the most common variants below.
All of these variants have the following form:
Observe that there is no close tag for the input element. The type attribute
can have one of the following values: text, password, checkbox, radio,
submit, reset, file, hidden, image, button.
The text and password variants create a textfield in which the user can enter
characters. The initial size is SIZE characters and the textfield is initialized with
the string of characters in VALUE . The password variant displays asterisks
for each character typed by the user.
The checkbox and radio variants create checkable buttons. If a button
is checked, then its VALUE will be sent to the server. Several buttons can
have the same name, in which case the server will receive several values for that
name. The radio variant allows the user to check at most one of the buttons
that share the same name.
The submit variant sends the data to the server when it is pressed and the
reset variant sets all fields in the form to their initial values.
The last four are more specialized and won't be discussed in detail here: file
is used for selecting a file on the users disk, hidden is an element that doesn't
appear on the webpage (but still specifies a value to be sent to the server), image
specifies a graphical submit button, and button is used for client side scripting,
which we do not discuss here.
The textarea element This element is used for soliciting multiline input
from the user, it has the form
initial text goes
here
In addition to the name, you must specify the size of the textarea in rows and
columns.
The select element The select element is used to provide a fixed list of
choices from which the user must choose. It has the form: