MACROMEDIA COLFUSION MX 7-CFML Reference page 377

Cfml reference
Hide thumbs Also See for COLFUSION MX 7-CFML:
Table of Contents

Advertisement

You cannot use the
following:
else if ( condition )
{
...
}
Exception handling with the cfscript tag
To handle exceptions with this tag, use
and
cftry
cfcatch
block, the variable
equivalent of the
cfcatch
Chapter 6, "Extending ColdFusion Pages with CFML Scripting" in ColdFusion MX Developer's
Guide.
Invoking ColdFusion components with the cfscript tag
CFScript invokes component methods using the
The following example shows how to invoke a component object with the
ordered arguments:
<cfscript>
quote = CreateObject( "component", "nasdaq.quote" ) ;
<!--- Invocation using ordered arguments. --->
res = quote.getLastTradePrice( "macr" ) ;
</cfscript>
The following example shows how to use an attribute collection within the
parameters when invoking a component object. An attribute collection is a structure in which
each key corresponds to a parameter name and each value is the parameter value passed for the
corresponding key.
<cfscript>
stArgs = structNew();
stArgs.translationmode = "en_es";
stArgs.sourceData= "Hello world, friend";
</cfscript>
...
<cfinvoke
webservice = "http://www.xmethods.net/sd/2001/BabelFishService.wsdl"
method
= "BabelFish"
argumentCollection = "#stArgs#"
returnVariable = "varName">
<cfoutput>#varName#</cfoutput>
In this example, the structure is created in a
method to create the structure.
construct within a
elseif
try
tags. For each
statement, you must have a
try
exceptionVariable
tag built-in variable
tag. You can use code such as the
cfscript
and
statements, which are equivalent to the
catch
contains the exception type. This variable is the
. For more information, see
cfcatch.Type
CreateObject
block, but you can use any ColdFusion
cfscript
statement. In the
catch
function.
tag, using
cfscript
tag to pass
cfscript
cfscript
catch
377

Advertisement

Table of Contents
loading

This manual is also suitable for:

Colfusion mx 7 - installing and using coldfusion mx

Table of Contents