196
Developing Web Applications with ColdFusion
to be triggered on every page --->
<CFSET MainPage = "default.cfm">
<CFSET session.current_location = "Davis, Porter, Alewife">
<CFSET sm_location = "dpa">
<CFSET current_page = "#cgi.path_info#?#cgi.query_string#">
Using Application Variables
Application variables require an application name be associated with them and are
always scoped within that application name.
Unlike client and session variables, however, application variables do not require that
a client name (client ID) be associated with them. Thus, they are available to any
clients that specify the same application name.
The name you establish in the CFAPPLICATION tag is accessible elsewhere in the
application by using the Application.ApplicationName variable. For example, you
would use this variable in the CFLOCK tag to restrict access to application variables to
one request at a time.
Storing application data in application variables
Application variables are designed to store application-level data. They are a
convenient place to store information that all pages of your application might need no
matter who (what client) is running that application. Using application variables, an
application could initialize itself, say, when the first user hit any page of that
application. This information could then remain available indefinitely to all
subsequent hits of any pages of that application, by all users, thereby avoiding the
overhead of repeated initialization.
Because the data stored in application variables is available to all pages of an
application and remains available until ColdFusion Server is shut down, application
variables are very convenient. However, because all clients running an application see
the same set of application variables, they are not useful for client-specific
information. To target variables for specific clients, use session variables.
Application variable time-outs
Application variables have a specific lifetime, and this lifetime defines an
"application." For example, when you access an application variable inside a specific
application, the variable returns a value because your request occurs on a page
declared in the CFAPPLICATION tag to be part of a single application.
The default time-out period for application variables is two days. In the Variables page
of the ColdFusion Administrator, you can define time-out values for application and
session variables. See Administering ColdFusion Server for more information.
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...