User Guide
Chapter 12: Using the Application Framework 201
The following sample code might be part of the Application.cfm file.
<HTML>
<HEAD>
<TITLE>Define Session and Application Variables</TITLE>
</HEAD>
<H3>CFAPPLICATION Example</H3>
<P>CFAPPLICATION defines scoping for a
ColdFusion applicationand enables or disables
the storing of client and/or session variables.
This tag is placed in the Application.cfm file
for the current application.
<CFAPPLICATION NAME="ETurtle"
SESSIONTIMEOUT=CreateTimeSpan("60")
SESSIONMANAGEMENT="yes">
<!--- Initialize the session and application
variables that will be used by E-Turtleneck. Use
the session lock for the session variables.
The member variable sessionID creates the
session name for you. --->
<CFLOCK SCOPE="Session"
TIMEOUT="30" TYPE ="Exclusive">
<CFIF NOT IsDefined("session.size")>
<CFSET session.size = "">
</CFIF>
<CFIF NOT IsDefined("session.color")>
<CFSET session.color = "">
</CFIF>
</CFLOCK>
<!--- Use the application lock for the
application variable. This variable keeps
track of the total number of turtlenecks sold.
The application lock should have the same name
as specified in the CFAPPLICATION tag. --->
<CFLOCK Scope="Application"
TIMEOUT="30"
TYPE="Exclusive">
<CFIF NOT IsDefined("application.number")>
<CFSET application.number = 1>
</CFIF>
</CFLOCK>
<CFLOCK SCOPE="Application"
TIMEOUT="30"
TYPE ="ReadOnly">