cfobject: component object

Description

The cfobject tag can create a ColdFusion component (CFC) object.

Syntax

<cfobject 
  name = "variable name"
  component = "component name">

See also

cfcollection, cfcomponent, cfexecute, cfindex, cfreport, cfsearch, cfwddx

Attributes

Attribute Req/Opt Default Description
name
Required

String; name for the instantiated component. The name must not have a period as the first or last character.
component
Required

Name of component to instantiate

Usage

Executing operations on a CFC object executes CFML code that implements the CFC's method in the CFC file. Using this tag to instantiate a component returns a ComponentProxy object that can delegate control to a CFC page.

Example

<!--- separate instantiation and method invocation; permits multiple 
invocations --->
<cfobject 
name="quoteService" 
component="nasdaq.quote">
<cfinvoke 
component="#quoteService#" 
method="getLastTradePrice" 
symbol="macr" 
returnVariable="res">
<cfoutput>#res#</cfoutput><br>

<cfinvoke 
component="#quoteService#" 
method="getLastTradePrice" 
symbol="mot" 
returnVariable="res">
<cfoutput>#res#</cfoutput>

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6

Comments are no longer accepted for ColdFusion MX. 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/CFML_Reference/Tags-pt26.htm