To create the CFC file:
Create a directory named components as a subdirectory of the my_app directory.
1.
Open a new blank file.
2.
Note: If you are using Dreamweaver, select Dynamic page in the Category list, and select
ColdFusion Component in the Dynamic Page list.
Enter the following code, or do the steps listed in the
3.
<cfcomponent displayName="Get Trips" hint="Get trip information">
<cffunction name="basicList" displayName="List all trips"
hint="List trips in same order as in table" access="public"
returnType="query" output="false">
<cfreturn>
</cffunction>
</cfcomponent>
Save the file as gettrips.cfc in the components directory.
4.
Let Dreamweaver do it
Dreamweaver lets you create a ColdFusion component without having to enter the code.
To create a CFC in Dreamweaver:
Click the Components tab.
1.
Click the + button.
2.
In the Display name text box, enter Get Trips.
3.
In the Hint text box, enter Get trip information.
4.
In the Name text box, enter gettrips.
5.
Click the Browse button, and make the components directory the current directory.
6.
In the Section list, click Functions.
7.
Click the + button.
8.
In the Name text box, enter basicList.
9.
In the Display name text box, enter List all trips.
10.
In the Hint text box, enter List trips in same order as in the table.
11.
Select query as the Return type.
12.
Click OK.
13.
Save the file as gettrips.cfc in the components directory.
14.
64
Chapter 6: Lesson 3: Retrieving Data
"Let Dreamweaver do it"
section.
Need help?
Do you have a question about the COLFUSION MX 7-GETTING STARTED BUILDING COLDFUSION MX and is the answer not in the manual?
Questions and answers