Getting Started

Tag Reference
cfoCollectGarbage
cfoCreateObject
cfoInit
cfoInvokeMethod
cfoRaiseEvent
cfoRegisterClass

Object Reference

Case Study

Download

Mailing List

Other Links

cfoCreateObject

Summary:
The cfoCreateObject tag is used to create an instance of an object from a class definition. The instance is returned to the caller in the form of a ColdFusion structure, containing a pointer to the class information and any instance variables defined by the constructor (if defined). The returned object can then be used in subsequent calls to cfoInvokeMethod, or can be used directly to set/get instance variables.

Attributes:
Attribute Description Default Required Deprecated
CLASS A string value that defines the class namespace of the object to create. Must refer to an existing class definition located within a mapping defined by the cfoInit libraryPath.   Yes No
OBJECT A string value that defines the variable name of the resulting object. Can include a scope such as "application" or "session", etc. "a" + classname No Yes
PACKAGE The name of a package if the class definition is located within a package.   No Yes
SRC An optional URL of a remote server. Must be a full path. This allows you to create remote objects and execute the methods on a remote server.   No No

Examples:

This example creates a local object named "aCustomer" from a class named "Customer".

<cf_cfoCreateObject class="Person.Customer">

This example creates a local object named "aSuperQuery".  It also captures the content between the start and end tags and stores it in an instance variable named "generatedContent". 

<cf_cfoCreateObject class="Code.Query.SuperQuery">
   select *
   from shopping_cart
   where shopping_cart.cartID = 100
</cf_cfoCreateObject>

This example creates a local object named "aCustomer" from a class named "Customer", and also sets two instance variables.  Instance variables created this way are defined before calling the constructor.

<cf_cfoCreateObject class="Person.Customer" firstName="Janet" lastName="Weiss">

This example creates a remote object.

<cf_cfoCreateObject class="Forums.ForumMessage" src="http://www.cfObjects.com/">

cfObjects version 2
cfObjects version 3











SourceForge.net Logo