This site contains older material on Eiffel. For the main Eiffel page, see http://www.eiffel.com.

3. HOW DO FORMS GET PROCESSED?

To help understand EiffelWeb it is useful to have a general picture of the tasks involved in processing a form received through the World-Wide Web.

When a visitor clicks on the submit button of an HTML form, the visitor's Web browser sends the contents of text fields, selected buttons and items to the server. In turn, the server transmits these data to the CGI script associated with the form. The transfer can be done via two distinct methods:

  • GET: data is made available through the environment variable, QUERY_STRING
  • POST: data is available on the standard input of the CGI script

With either method, all the fields are concatenated into a unique string which has the following structure:

    field1=value1&field2=value2&...

Space characters are converted to `+' and any special character is replaced by its hexadecimal code.

Execution of the CGI script also sets a number of environment variables, defining: the method, GET POST, with which the script was called (REQUEST_METHOD); the length of the data (CONTENT_LENGTH); the name of the server (SERVER_NAME); and others.

A CGI script written in an ordinary scripting language will typically perform the following tasks in response to a visitor submitting a form:

  • Determine the method with which it was called, so as to know where to get the input. With EiffelWeb you will not need this step, as EiffelWeb takes care of finding the input for you.
  • Parsing the input, to decode the fields and obtain their values. With EiffelWeb you do not need to worry about this aspect, as EiffelWeb decodes everything and puts the result into Eiffel objects.
  • Process the input as needed by the application. EiffelWeb provides a specific place (the procedure execute of class CGI_INTERFACE) for such processing, various features and an array fields containing all the input fields, and of course the whole power of ISE Eiffel and its libraries to perform all the processing that you need.
  • Most of the time, produce output to be sent to the visitor in HTML form. Here too EiffelWeb provides all the necessary output facilities, taking care of generating the proper HTML syntax for you.

Table of contents | Next chapter