About ColdFusion components
This section describes ColdFusion components (CFCs). It introduces basic CFC concepts and
features.
Basic component concepts
The following sections introduce ColdFusion components and define the basic vocabulary and
concepts that you must understand to use CFCs.
What CFCs are
ColdFusion components are special ColdFusion objects that contain both data (also called
properties) and functions (also called methods). For example, you use the
function to create instances of CFCs that can hold data as well as functions. CFCs
CreateObject
also provide a number of special features that go beyond simply encapsulating code and data,
including the following:
•
Include object-oriented features
•
Provide security and access controls
•
Let you export ColdFusion functionality as web services
•
Let you provide ColdFusion functionality efficiently to Flash clients
CFCs are ColdFusion Markup Language (CFML) pages. Each CFC is defined in a CFM file,
called a component page, which must have the extension .cfc. Component pages use the same tags
and functions that regular CFML pages do, plus a small number of special tags (in particular, the
tag) and tag attributes.
cfcomponent
CFCs and object-oriented programming
CFCs do not require you to do object-oriented programming in ColdFusion, but they do contain
several object-oriented features and let you use object-oriented concepts and structures in your
programming. CFC object-oriented features are similar to some of the object-oriented elements
that are in Netscape JavaScript 2.0 and are proposed for ECMAScript 4; they do not strictly
follow Java object rules or architecture.
CFCs let you take advantage of some of the more powerful features of object-oriented
programming, such as encapsulation, inheritance, and introspection.
CFCs encapsulate application functionality and provide a standard interface for client access to
that functionality. Clients can access component functionality by invoking (calling) methods on
components. Components support a variety of client interfaces, including web pages,
Macromedia Flash movies, web services, and other objects accessible from ColdFusion
components and pages. Component method invocation serves as the gateway to component
functionality, including passing parameters and receiving component method results.
One CFC can inherit the methods and properties of another CFC. This feature lets you build
multiple specific components without recoding the basic building blocks of the components.
CFCs support introspection; that is, they can provide information about themselves. If you display
a component page directly in an HTML browser, inspect it in the ColdFusion and Macromedia
Dreamweaver MX component browsers, or use the CFML
information about the component, including its path, property, methods, and additional
information that you can specify using special documentation attributes and tags.
220
Chapter 11: Building and Using ColdFusion Components
cfobject
function, you see
GetMetadata
tag and
Need help?
Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?
Questions and answers