User Guide

Table Of Contents
About scopes 65
Scope types
The following table describes ColdFusion scopes:
Scope Description
Variables
(local)
The default scope for variables of any type that are created with the
cfset and
cfparam tags. A local variable is available only on the page on which it is created and
any included pages (see also the Caller scope).
Form Contains variables passed from a Form page to its action page as the result of
submitting the form. (If you use the HTML
form tag, you must use method="post".)
For more information, see Chapter 26, “Introduction to Retrieving and Formatting
Data,” on page 609.
URL Contains parameters passed to the current page in the URL that is used to call it.
The parameters are appended to the URL in the format ?variablename =
value[&variablename=value...]; for example www.MyCompany.com/
inputpage.cfm?productCode=A12CD1510&quantity=3.
Note: If a URL includes multiple parameters with the same name, the resulting
variable in the ColdFusion URL scope consists of all parameter values separated by
commas. For example, a URL of the form http://localhost/urlparamtest.cfm?
param=1&param=2&param=3 results in a URL.param variable value of 1,2,3 on the
ColdFusion page.
Attributes Used only in custom tag pages. Contains the values passed by the calling page in
the custom tag’s attributes. For more information, see Chapter 11, “Creating and
Using Custom CFML Tags,” on page 241.
Caller Used only in custom tag pages. The custom tag’s Caller scope is a reference to the
calling page’s Variables scope. Any variables that you create or change in the
custom tag page using the Caller scope are visible in the calling page’s Variables
scope. For more information, see Chapter 11, “Creating and Using Custom CFML
Tags,” on page 241.
ThisTag Used only in custom tag pages. The ThisTag scope is active for the current
invocation of the tag. If a custom tag contains a nested tag, any ThisTag scope
values you set before calling the nested tag are preserved when the nested tag
returns to the calling tag.
The ThisTag scope includes three built-in variables that identify the tag’s execution
mode, contain the tag’s generated contents, and indicate whether the tag has an
end tag.
A nested custom tag can use the
cfassociate tag to return values to the calling tag’s
ThisTag scope. For more information, see “Accessing tag instance data”
on page 250.
Request Used to hold data that must be available for the duration of one HTTP request. The
Request scope is available to all pages, including custom tags and nested custom
tags, that are processed in response to the request.
This scope is useful for nested (child/parent) tags. This scope can often be used in
place of the Application scope, to avoid the need for locking variables. Several
chapters discuss using the Request scope.
CGI Contains environment variables identifying the context in which a page was
requested. The variables available depend on the browser and server software. For
a list of the commonly used CGI variables, see Chapter 1, “Reserved Words and
Variables,” in CFML Reference.