Using ColdFusion components
225
•
If you invoke a CFC method remotely, using a specific URL, form field, Flash Remoting MX,
or a web service invocation, ColdFusion looks in the specified path relative to the web root.
For form fields and URLs specified directly on local web pages, ColdFusion also searches
relative to the page directory.
Note:
On UNIX and Linux systems, ColdFusion MX attempts to match a CFC name or Custom tag
name with a filename as follows: First, it attempts to find a file with the name that is all lowercase. If it
fails, it then tries to find a file whose case matches the CFML case. For example, if you specify
<cfobject name="myObject" Component="myComponent">
, ColdFusion first looks for
mycomponent.cfc and, if it doesn't find it, ColdFusion looks for myComponent.cfc.
Instantiating CFCs
If you use a CFC multiple times in a ColdFusion request, or if you use a CFC with persistent
properties, use the
cfobject
tag or
CreateObject
function to instantiate the CFC before you
call its methods.
The following example uses the
cfobject
tag to create an instance of the tellTime CFC.
<cfobject component="tellTime" name="tellTimeComp">
The following example uses the
cfobject
tag to instantiate the same component in CFScript:
tellTimeComp = CreateObject("component", "tellTime");
CFC invocation techniques
There are many ways to invoke or call CFC methods. The following table lists the techniques,
including the ColdFusion tags and functions that you use:
Invocation
Description
For more information
cfinvoke
tag
Invokes a component method. Can invoke
methods of a CFC instance or invoke the
methods transiently.
See
“Invoking CFC methods with
the cfinvoke tag” on page 226
.
cfset
tag and
assignment
statements
Invoke methods and access properties of a
component instance.
See
“Using components directly in
CFScript and CFML” on page 229
.
URL
(HTTP GET)
Transiently invokes a component method by
specifying the component and method
names in the URL string.
See
“Invoking component methods
using a URL” on page 230
.
Form control
(HTTP POST)
Transiently invokes a component method
using the HTML
form
and
input
tags and
their attributes.
See
“Invoking component methods
using a form” on page 231
.
Flash Remoting
NetServices ActionScript functions can
transiently invoke component methods.
See
Chapter 29, “Using the Flash
Remoting Service,” on page 641
.
Web services
The
cfinvoke
tag and CFScript consume
web services in ColdFusion MX. External
applications can also consume CFC
methods as web services.
See
Chapter 32, “Using Web
Services,” on page 707
.
Summary of Contents for ColdFusion MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......