1. THE ROLE OF EIFFELWEB
The World-Wide Web provides a remarkably versatile way to make information available to the world. But the flow should not just be one way: a Web site will want to obtain input from its visitors. This can provide feedback, new ideas, and sales leads.
The simplest way for a Web site visitor to send such input is to fill in a form on one of the site's pages. This requires, on the other end, some software to process the form and extract its information. Such software is known as a CGI script, where the initials stand for Common Gateway Interface.
Before EiffelWeb, CGI scripts were usually written in scripting languages such as Perl, or in C. For very simple processing of small forms this suffices; but scripts, like any other software,must grow and evolve. Object technology can offer a better solution - easier to produce, easier to maintain, easier to extend - than low-level approaches.
The EiffelWeb library provides script developers with a simple set of tools to develop CGI scripts using the full benefits of Eiffel.
Why use EiffelWeb?
Although the concepts should be simple, form processing can be unpleasantly tedious. EiffelWeb provides a general framework, taking care of all the repetitive details, and frees you of many low-level tasks. In particular:
You do not need to worry about which of the two available methods (GET
and POST) has been used to return data. One uses an environment
variable, the other writes to the standard input, but EiffelWeb will get
the data, wherever it is, to your application.
The basic format of the data returned from a form is very low-level:
a set of fields separated by & characters, with special encoding
for blanks and non-alphabetic characters. With ordinary CGI scripts, you
must parse this information. EiffelWeb does the parsing for you and makes
the resulting fields directly available.
After processing a form you will often display further information
to the person who has submitted it. This information must be in HTML format
(HTML, HyperText Markup Language, is the language used to format documents
to be displayed by Web browsers). With ordinary scripting languages, you
must take care of the HTML codes yourself. With EiffelWeb, you can use
a set of high-level procedures taking care of the basic forms of output;
the procedures will generate the proper HTML codes for you. You do not
need to know HTML to use EiffelWeb.
Debugging a form-processing system can be extremely tricky. EiffelWeb
provides you with a rich set of mechanisms to try out your application,
set environment variables, specify what should happen in the case of an
Best of all, the actual processing can benefit from the whole power of the Eiffel language, the ISE Eiffel environment, and the ISE Eiffel libraries. You have a full development environment at your disposal, rather than the limited expressive power of a simple scripting language.
This manual shows how to use EiffelWeb. It is organized as follows:
Below is a short description of the EiffelWeb classes.
Chapter 2 shows how to write a small form-processing application. The
example will be sufficient for many simple uses.
Chapter 3 gives some background about HTML form processing.
Chapter 4 explains how your application can access user information
and environment variables.
Chapter 5 describes debugging facilities.
Chapter 6 presents the class HTML_GENERATOR for generating HTML
Appendix A presents the principal class, CGI_INTERFACE.
Appendix B presents class CGI_ENVIRONMENT.
Appendix C presents class HTML_GENERATOR.
Appendix D presents class HTML_CONSTANTS, used by HTML_GENERATOR.
Here is a short description of each class:
CGI_ENVIRONMENT: provides access to environment variables, including
all the standard variables.
CGI_INTERFACE: a deferred class that encapsulates the behavior
of all CGI scripts. It includes the data processing operations common to
all scripts, namely the parsing of the string sent by the server and the
HTML_CONSTANTS: defines a subset of the HTML language tags as
Eiffel constants. Its obvious purpose is to be used for HTML generation
(more will be added in future versions).
HTML_GENERATOR: implements a series of routines facilitating the generation of basic HTML documents. The output medium can be changed by simply redefining the routine put_basic.