Viewing Application Pages

You view the application page on the Web server to ensure that the code is working as expected. Presently, your page is very simple. But, as you add more code, you will want to ensure that the page continues to work.

Note To view the page in a local browser:
  1. Open a Web browser on your local machine and enter the following URL:
    http://127.0.0.1/myapps/calldept.cfm
    

    Where 127.0.0.1 refers to the localhost and is only valid when you are viewing pages locally.

  2. Use the Web browser facility that allows you to view a page's source code to examine the code that the browser uses for rendering.

    Note that only HTML and text is returned to the browser.

    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's returned to the browser.

    Original ColdFusion page HTML file returned by Web server
    <HTML>
    <HEAD>
    <TITLE>Call Department</TITLE>
    </HEAD>
    <BODY>
    <STRONG>Call Department</STRONG>
    <!--- Set all variables --->
    <CFSET Department="Sales">
    <CFOUTPUT>
    I'd like to talk to someone in 
    #Department#.
    <!--- Display results --->
    </CFOUTPUT>
    </BODY>
    </HTML>
    
    <HTML>
    <HEAD>
    <TITLE>Call Department</TITLE>
    </HEAD>
    <BODY>
    <STRONG>Call Department</STRONG>
    
    
    
    I'd like to talk to someone in 
    Sales.
    
    
    </BODY>
    </HTML>
    

Code Review

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 be "Sales." You then used the CFML tag CFOUTPUT to display text and the value of the variable.

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 case the text "I'd like to talk to someone in" followed by the value of the variable Department, which is "Sales."