Using ColdFusion components

Unlike other Coldfusion reusable elements, ColdFusion components encapsulate multiple, related, functions. A ColdFusion component is essentially a set of related UDFs and variables, with additional functionality to provide and control access to the component contents. ColdFusion components can make their data private, so that it is available to all functions (also called methods) in the component, but not to any application that uses the component.

ColdFusion components have the following features:

Creating and using ColdFusion components

Creating and using a component is more complex than creating and using a user-defined function (UDF). For example, you specify a component and one or more functions. You can invoke ColdFusion components in many ways, including using the cfinvoke and cfobject tags. You can also use forms, URLs, and the Flash client-side ActionScript.

To invoke a component method with a cfinvoke tag, use code such as the following:

<cfinvoke component="componentName" method="methodName" returnVariable="variableName" argumentCollection="argumentStruct">

Recommended uses

Consider using ColdFusion components when doing the following:

For more information

For more information on using ColdFusion components, see Chapter 11, "Building and Using ColdFusion Components".

Comments