Using Coldfusion Components - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

You can create persistent CFCs by assigning the CFC instance to a persistent scope, such as the
Session or Application scope. This way, you can create CFCs for objects, such as shopping carts or
logged-in users, that must persist for sessions. You can also create CFCs that provide application-
specific data and methods.
ColdFusion provides many ways to instantiate CFCs and invoke CFC methods. For detailed
information, see

Using ColdFusion components

This section includes the following information about using component methods:
Describes how ColdFusion finds CFCs and how to specify a CFC location
Describes how create CFC instances and invoke CFC methods from within ColdFusion MX
Briefly discusses invoking CFC methods from outside ColdFusion
Discusses how to use ColdFusion MX and Macromedia Dreamweaver MX tools to learn about
the CFCs on a server
Specifying the CFC location
When you instantiate or invoke a component, you can specify the component name only, or you
can specify a qualified path. To specify a qualified path, separate the directory names with periods,
not slashes; for example, myApp.cfcs.myComponent specifies the component defined in
myApp\cfcs\myComponent.cfc.
ColdFusion uses the following rules to find the specified CFC.
If you use a
cfinvoke
a CFML page, ColdFusion searches directories in the following order:
Local directory of the calling CFML page
a
Directories specified on the ColdFusion Mappings page of the ColdFusion MX
b
Administrator
Web root
c
Directories specified on Custom Tag Paths page of the Administrator
d
If you specify only a component name, ColdFusion searches each of these directories, in turn,
for the component.
Note: If you use only the component name to specify the CFC, ColdFusion does not search the
directories specified in the Administrator on the ColdFusion Mappings page. If you specify a
qualified path that starts with a mapped directory name, ColdFusion does find the component.
If you specify a qualified path, such as myApp.cfcs.myComponent, ColdFusion looks for a
directory matching the first element of the path in each of these directories (in this example,
myApp). If it finds a matching directory, it then looks for a file in the specified path beneath
that directory, such as myApp\cfcs\myComponent.cfc relative to each of these directories.
Note: If ColdFusion finds a directory that matches the first path element, but does not find a CFC
under that directory, ColdFusion returns a not found error and does not search for another
directory.
224
Chapter 11: Building and Using ColdFusion Components
"Using ColdFusion components" on page
or
tag, or the
cfobject
224.
function to access the CFC from
CreateObject

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents