| Contents > Developing ColdFusion MX Applications > Building and Using ColdFusion Components > Building ColdFusion components > Defining component methods |
|
|
|
|
||
You define component methods using cffunction tags, as the following example shows, which defines a getEmp method:
<cffunction name="getEmp" displayname="Get Employee" access="remote">
<cfquery name="empQuery" datasource="ExampleApps" dbtype="ODBC" >
SELECT FIRSTNAME, LASTNAME, EMAIL
FROM tblEmployees
</cfquery>
<cfreturn empQuery>
</cffunction>
Because component methods are ColdFusion functions, most of their features and coding techniques are identical to those of user defined functions. For more information on using the cffunction tag to create functions, see Writing and Calling User-Defined Functions.
Tip: To improve performance, avoid using the cfparam tag in CFC methods. Instead, use the cfset tag or CFScript assignment statements.
The following cffunction tag attributes are used only for CFCs:
displayname and hint attributes document the CFC; for more information, see Documenting CFCs.access attribute controls access to the CFC; for more information , see Using access security.For detailed reference information on the cffunction tag, see CFML Reference.
|
|
||
| Contents > Developing ColdFusion MX Applications > Building and Using ColdFusion Components > Building ColdFusion components > Defining component methods |
|
|
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6.1
Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/buildi37.htm
Comments
jshaffner said on Jun 22, 2004 at 7:25 AM :