Contents > CFML Reference > ColdFusion Tags > cfobject: component object PreviousNext

cfobject: component object

Creates an instance of a ColdFusion component (CFC) object.

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

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

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

When the cfobject tag creates an instance of the CFC, ColdFusion executes any constructor code in the CFC; that is, it runs code that is not in the method definitions.

On UNIX systems, ColdFusion searches first for a file with a name that matches the specified component name, but is all lower case. If it does not find the file, it looks for a file name that matches the component name exactly, with the identical character casing.

<!--- 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>

Contents > CFML Reference > ColdFusion Tags > cfobject: component object PreviousNext

ColdFusion 9 | 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/tags-pb7.htm