ColdFusion MX: From Static to Dynamic in 10 Steps

Team-Fly    

ColdFusion® MX: From Static to Dynamic in 10 Steps

By Barry Moore

Table of Contents
Step 8.  ColdFusion Application Framework

In this example, we are going to build a template to display all of the built-in shared memory scope variables.

  1. Open your text editor and type the code in Listing 8.2 or open the completed ScopeVariables.cfm file from the CompletedFiles\Examples\Step08 folder.

    Listing 8.2 ScopeVariables.cfm

    <!--- File: ScopeVariables.cfm Description: Display shared memory scope variables Author: Created: ---> <HTML> <HEAD> <TITLE>Share Memory Scope Variables</TITLE> </HEAD> <BODY> <H2>Shared Memory Scope Variables</H2> <H3>Session Scope</H3> <CFOUTPUT> <!--- lock scope before reading ---> <CFLOCK SCOPE="SESSION" TIMEOUT="10" THROWONTIMEOUT="No" TYPE="READONLY" > <B>Session CFID:</B> #Session.CFID#<BR> <B>Session CFToken:</B> #Session.CFToken#<BR> </CFLOCK> <HR> <H3>Application Scope</H3> <!--- lock scope before reading ---> <CFLOCK SCOPE="APPLICATION" TIMEOUT="10" THROWONTIMEOUT="No" TYPE="READONLY"> <B>Application Name:</B> #Application.ApplicationName# </CFLOCK> <HR> <H3>Server Scope</H3> <!--- lock scope before reading ---> <CFLOCK SCOPE="SERVER" TIMEOUT="10" THROWONTIMEOUT="No" TYPE="READONLY"> <B>Product:</B> #Server.ColdFusion.ProductName#<BR> <B>Product Level:</B> #Server.ColdFusion.Productlevel#<BR> <B>Product Version:</B> #Server.ColdFusion.ProductVersion#<BR> <B>Expiration:</B> #Server.Coldfusion.Expiration#<BR> <B>Serial Number:</B> #Server.ColdFusion.SerialNumber#<BR> <B>Root Directory:</B> #Server.ColdFusion.RootDir#<BR> <B>Supported Locales: </B>#Server.ColdFusion.SupportedLocales#<BR> <BR> <B>OS Name:</B> #Server.OS.Name#<BR> <B>OS Version:</B> #Server.OS.Version#<BR> <B>Build Number:</B> #Server.OS.BuildNumber#<BR> <B>OS Architecture:</B> #Server.OS.Arch#<BR> <B>Additional Information:</B> #Server.OS.AdditionalInformation#<BR> </CFLOCK> </CFOUTPUT> </BODY> </HTML>

  2. Save this file as ScopeVariables.cfm in your Examples\Step08 folder.

  3. Browse to this file with your browser. Provided that you created the Application.cfm in Example 8.1: Creating an Application.cfm File, you should see a browser display similar to the one in Figure 8.10.

    Figure 8.10. The ScopeVariables.cfm browser display.


    Team-Fly    
    Top
     

    Категории