Macromedia coldfusion 4.5-cfml language reference User Manual

Page of 608
Chapter 1:  ColdFusion Tags
127
<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">
<CFOUTPUT>
E-Turtleneck is proud to say that we have sold
#application.number# turtlenecks to date.
</CFOUTPUT>
    </CFLOCK>
<!----------------------------------------------------------------------
End of Application.cfm 
------------------------------------------------------------------------> 
<HEAD>
<TITLE>
CFLOCK Example
</TITLE>
</HEAD>
<BASEFONT FACE="Arial, Helvetica" SIZE=2>
<BODY  bgcolor="#FFFFD5">
<H3>CFLOCK Example</H3>
<CFIF IsDefined("form.submit")>
<CFOUTPUT>
Thank you for shopping E-Turtleneck. Today you have
chosen a turtleneck in size <b>#form.size#</b> and in the color
<b>#form.color#</b>. 
</CFOUTPUT>
<!----------------------------------------------------------------- 
 Lock session variables to assign form values to them. 
-------------------------------------------------------------------> 
<CFLOCK SCOPE="Session" TIMEOUT="30" TYPE="Exclusive">
<CFPARAM NAME=session.size Default=#form.size#>
<CFPARAM NAME=session.color Default=#form.color#>
</CFLOCK>
<!------------------------------------------------------------------ 
Lock application variable application.number to find the total number 
of turtlenecks sold. 
------------------------------------------------------------------->