Adobe COLDFUSION 9 Manual page 314

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
The following code from an Application.cfm file does the same thing as the previous example:
<cfapplication name"SearchApp"
clientmanagement="Yes"
clientstorage="mydatasource">
Using client variables
When you enable client variables for an application, you can use them to keep track of long-term information that is
associated with a particular client.
Client variables must be simple data types: strings, numbers, lists, Booleans, or date and time values. They cannot be
arrays, recordsets, XML objects, query objects, or other objects. If you must store a complex data type as a client
variable, you can use the
cfwddx
WDDX data, and use the
cfwddx
WDDX, see
"Using WDDX" on page 1088
Note: When saving client variable data in WDDX format, in the case of the registry and SQL Server, the limit is about
4K; with ORACLE, the limit is about 2K.
Creating a client variable
To create a client variable and set its value, use the
variable prefix; for example:
<cfset Client.FavoriteColor="Red">
After you set a client variable this way, it is available for use within any page in your application that is accessed by the
client for whom the variable is set.
The following example shows how to use the
default value if the parameter does not exist:
<cfparam name="Client.FavoriteColor" default="Red">
Accessing and changing client variables
You use the same syntax to access a client variable as for other types of variables. You can use client variables anywhere
you use other ColdFusion variables.
To display the favorite color that has been set for a specific user, for example, use the following code:
<cfoutput>
Your favorite color is #Client.FavoriteColor#.
</cfoutput>
To change the client's favorite color, for example, use code such as the following:
<cfset Client.FavoriteColor = Form.FavoriteColor>
Standard client variables
The Client scope has the following built-in, read-only variables that your application can use:
tag to convert the data to WDDX format (which is represented as a string), store the
tag to convert the data back when you read it. For more information on using
.
or
cfset
cfparam
tag to check for the existence of a client parameter and set a
cfparam
Last updated 8/5/2010
tag and use the Client scope identifier as a
309

Advertisement

Table of Contents
loading

Table of Contents