Understanding the Web s Statelessness

 < Day Day Up > 



Understanding the Web's "Statelessness"

There's a problem inherent in building programs that use HTML as an interface — statelessness. To better understand statelessness, consider the way users views Web pages. Typically, they either type an address, select a bookmark, or click a link. This causes their browser to contact a specific server and request a page. When the page and its contents are returned to the user, the connection between user and server no longer exists. The server has no way of sending or retrieving data from the user unless the user requests another page. Neither can the server know whether the user is still looking at the page, whether they've moved on to another Web site, or whether they've closed their browser and left their computer chair.

That presents a problem for many programming languages, because there are lots of common programming tasks that require variables to persist for long periods of time, or throughout various aspects of a program. A shopping cart, for example, needs to store data on products a user has selected in a store. This data may need to persist for as long as a user is browsing the store, or in some cases, for weeks or months in case the user leaves the site, returns later, and wants to recall the products selected in the previous session.

Another example is a login system, whereby a program may need to periodically check whether a user has successfully logged in before showing the user a protected page. The Web's standard request-and-serve system has no way to handle these persistent variables. A Web server isn't capable of storing program variable data once its connection with a user has terminated. This is called statelessness.

ColdFusion provides several solutions to combat the Web's statelessness in the form of client variables, session variables, and application variables. These are collectively called client-state management tools. All are capable of storing variable values that may be associated with a specific user or user session, persist over time, and can be recalled by any template within an application — without having to pass the variables via a URL or a form.



 < Day Day Up > 



Macromedia Studio MX Bible
Macromedia Studio MX Bible
ISBN: 0764525239
EAN: 2147483647
Year: 2003
Pages: 491

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net