| Contents > Developing ColdFusion MX Applications > Using ColdFusion Variables > About scopes > Creating and using variables in scopes |
|
|
|
|
||
The following table shows how you create and refer to variables in different scopes in your code. For more information on the mechanisms for creating variables in most scopes, see Creating variables.
Scope (type) |
Prefix |
Where available |
Created by |
|---|---|---|---|
Variables (Local) |
No |
On the current page. Cannot be accessed by a form's action page (unless the form page is also the action page). Variables in this scope used on a page that calls a custom tag can be accessed in the custom tag by using its Caller scope; however, they are not available to any nested custom tags. |
Specifying the prefix Variables, or using no prefix, when you create the variable. |
Form |
No |
On the action page of a form and in custom tags called by the action page; cannot be used on a form page that is not also the action page. |
A |
URL |
No |
On the target page of the URL. |
The system. Contains the parameters passed in the URL query string used to access the page. |
Attributes |
Yes |
On the custom tag page. |
The calling page passing the values to a custom tag page in the custom tag's attributes. |
Caller |
On the custom tag page, Yes. On the calling page, No (Variables prefix is optional). |
On the custom tag page, by using the Caller scope prefix. On the page that calls the custom tag, as local variables (Variables scope). |
On the custom tag page, by specifying the prefix Caller when you create the variable. On the calling page, by specifying the prefix Variables, or using no prefix, when you create the variable. |
ThisTag |
Yes |
On the custom tag page. |
Specifying the prefix ThisTag when you create the variable in the tag or using the cfassociate tag in a nested custom tag. |
Request |
Yes |
On the creating page and in any pages invoked during the current HTTP request after the variable is created, including in custom tags and nested custom tags. |
Specifying the prefix Request when you create the variable. |
CGI |
No |
On any page. Values are specific to the latest browser request. |
The web server. Contains the server environment variables that result from the browser request. |
Cffile |
Yes |
Following an invocation of |
A cffile tag. |
Cookie |
No |
For one client in one or more applications and pages, over multiple browser sessions. |
A cfcookie tag. You can also set memory-only cookies by specifying the prefix Cookie when you create the variable. |
Client |
No |
For one client in one application, over multiple browser sessions. |
Specifying the prefix Client when you create the variable. |
Session |
Yes |
For one client in one application and one browser session. Surround all code that uses application variables in cflock blocks. |
Specifying the prefix Session when you create the variable. |
Application |
Yes |
For multiple clients in one application over multiple browser sessions. Surround all code that uses application variables in |
Specifying the prefix Application when you create the variable. |
Server |
Yes |
To any page on the ColdFusion server. Surround all code that uses server variables in |
Specifying the prefix Server when you create the variable. |
Flash |
Yes |
A ColdFusion page or ColdFusion component called by a Flash client. |
The ColdFusion Client access. You assign a value to Flash.You can assign values to the Flash.result and Flash.pagesize variables. |
Arguments |
No |
Within the body of a user-defined function or ColdFusion component method. |
The calling page passing an argument in the function call. |
This |
Yes |
Within a ColdFusion component or the body of a user-defined function that was created using the cffunction tag and put in an object, structure, or scope. In the containing page, through the component instance or containing object. |
Within the component or function by specifying the prefix This when you create the variable. In the containing page, by specifying the component instance or object that contains the function as a prefix when you create the variable. |
(function local, no prefix) |
Prohibited |
Within the body of a user-defined function or ColdFusion component method, only while the function executes. |
In the function or method definition, a |
|
|
||
| Contents > Developing ColdFusion MX Applications > Using ColdFusion Variables > About scopes > Creating and using variables in scopes |
|
|
ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6.1
Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/variab36.htm