HTML CSS PHP PERL

The Stateless Web

 
Previous Table of Contents Next

The Stateless Web

Writing complex multipage forms using CGI programs offers a unique programming challenge. The connection between a Web browser and a Web server is not a long-term connection. The Web browser connects to the server, retrieves the page, and then disconnects from the Web server. No sustained connection is kept between the server and your browser.

To make matters more complicated, each time the browser connects to the Web server, the Web server doesn't recognize the browser as having been to the site beforehand. The server has no easy way of recognizing the browser each time.

An analogy that works well is that of a conversation between a library patron and a librarian with no memory. The patron is allowed to ask only one question at a time. The patron can ask the librarian for a booksay, on Arizonaand the librarian can retrieve it. The librarian can retrieve the book because he or she can fulfill simple requests easily. However, the patron cannot request another book on the same subject. The librarian would have no memory of the prior request and would be helpless. If the request were rephrased as "give me another book on Arizona," the librarian would still be unable to help because he or she might retrieve the same book on Arizona as he or she did for the first request.

The only way to retrieve a second book on the subject would be to say, "I need another book on Arizona; I already have Settling of the Southwest." That request has enough information to state the problem and let the librarian know what's not an appropriate response.

Writing multipage forms for the Web uses the same solution: Each question/answer session needs to contain enough information so that the Web server can figure out what needs to be done and what has already been done. You can create such sessions in a few different ways; one of themusing hidden HTML fieldsis presented in this hour.

    Previous Table of Contents Next
    © 2000- NIV