Adobe COLDFUSION 9 Manual page 205

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Building Blocks of ColdFusion Applications
Before invoking the CFC, Variables.Myname is: Wilson.
Passing Variables scope to hello method. It returns: Hello Wilson.
After invoking the CFC, Variables.Myname is: Wilson.
Within the VarScopeInCfc method, Variables.MyName is: Tuckerman
The Arguments scope
The Arguments scope exists only in a method, and is not available outside the method. The scope contains the variables
that you passed into the method, including variables that you passed in the following ways:
• As named attributes to the
• In the
cfargumentcollection
• In cfinvokeargument tags
• As attributes or parameters passed into the method when the method is invoked as a web service, by Flash
Remoting, as a direct URL, or by submitting a form
You can access variables in the Arguments scope using structure notation (
notation (
or
Arguments[1]
The Arguments scope does not persist between calls to CFC methods.
Variables in the Arguments scope are available to pages included by the method.
Other variable scopes
A CFC shares the Form, URL, Request, CGI, Cookie, Client, Session, Application, Server, and Flash scopes with the
calling page. Variables in these scopes are also available to all pages that are included by a CFC. These variables do not
have any behavior that is specific to CFCs.
Function local variables
Variables that you declare with the Var keyword inside a cffunction tag or CFScript
only in the method in which they are defined, and only last from the time the method is invoked until it returns the
result. You cannot use the Var keyword outside function definitions.
Note: Always use the Var keyword or Local scope name on variables that are only used inside the function in which they
are declared.
Define all function local variables at the top of the function definition, before any other CFML code; for example:
<cffunction ...>
<cfset Var testVariable = "this is a local variable">
<!--- Function code goes here. --->
<cfreturn myresult>
</cffunction>
Any arguments declared with the
can also place any
cfscript
Use function local variables if you place the CFC in a persistent scope such as the Session scope, and the function has
data that must be freed when the function exits.
Local variables do not persist between calls to CFC methods.
Local variables are available to pages included by the method.
tag
cfinvoke
attribute of the
cfinvoke
"
Arguments[
variablename
tag must appear before any variables defined with the
cfargument
tag first and define variables that you declare with the Var keyword in the script.
Last updated 8/5/2010
tag
Arguments.variablename
"
).
]
function
200
), or array
definition are available
tag. You
cfset

Advertisement

Table of Contents
loading

Table of Contents