User Guide
12 Chapter 2 Writing Your First ColdFusion Application
Compare the code that was returned to the browser with what you originally
created. Notice that the ColdFusion comments and CFML tags are processed, but
do not appear in the HTML file that is returned to the browser.
Reviewing the code
The application page that you just created contains both HTML and CFML. You used
the CFML tag
cfset to define a variable, Department, and set its value to “Sales.” You
then used the CFML tag c
foutput to display text and the value of the variable. The
following table describes the code and its function:
Original ColdFusion page HTML file returned by Web server
<html>
<head>
<title>Call Department</title>
</head>
<body>
<strong>Call Department</strong><br>
<!--- Set all variables --->
<cfset department="Sales">
<!--- Display results --->
<cfoutput>
I’d like to talk to someone in
#Department#.
</cfoutput>
</body>
</html>
<html>
<head>
<title>Call Department</title>
</head>
<body>
<strong>Call Department</strong><br>
I’d like to talk to someone in Sales.
</body>
</html>
Code Description
<!--- Set all variables --->
CFML comment, which is not returned in the
HTML page.
<cfset Department="Sales">
Creates a variable named Department and sets
the value equal to Sales.
<!--- Display results --->
CFML comment, which is not returned in the
HTML page.
<cfoutput>
I’d like to talk to someone in
#Department#.
</cfoutput>
Displays whatever appears between the opening
and closing
cfoutput tags; in this example, the
text “I'd like to talk to someone in” is followed by
the value of the variable Department, which is
“Sales.”