Using ColdFusion Components

ColdFusion Components are used by other ColdFusion code, although rather than used, CFCs are said to be invoked. A special tag is used to invoke ColdFusion Components, and not surprisingly the tag is named <cfinvoke>. To invoke a ColdFusion Component you’ll need to specify several things:

  • The name of the CFC to be used.

  • The name of the method to be invoked (CFCs may contain multiple methods).

  • The name of a variable that should contain any returned data.

  • In addition, if the CFC method being invoked accepts arguments, those arguments are to be provided.

Listing 11.6 is a simple file named testcfc.cfm. As its name suggests, it tests the CFC file you just created.

Listing 11.6. testcfc.cfm—CFC Tester Step 1
<!--- Name: testcfc.cfm ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.