MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual page 341

Developing coldfusion mx applications
Table of Contents

Advertisement

<!--- Always display the number of turtlenecks sold --->
<cflock scope="Application"
timeout="10"
type ="ReadOnly">
<cfoutput>
E-Turtleneck is proud to say that we have sold
#Application.number# turtlenecks to date.
</cfoutput>
</cflock>
The remaining sample code could appear inside the application page where customers place
orders:
<html>
<head>
<title>cflock Example</title>
</head>
<body>
<h3>cflock Example</h3>
<cfif IsDefined("Form.submit")>
<!--- Lock session variables --->
<!--- Note that we use the automatically generated Session
ID as the order ID --->
<cflock scope="Session"
timeout="10" type="ReadOnly">
<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>.
Your order ID is #Session.sessionID#.
</cfoutput>
</cflock>
<!--- Lock session variables to assign form values to them. --->
<cflock scope="Session"
timeout="10"
type="Exclusive">
<cfparam name=Session.size default=#form.size#>
<cfparam name=Session.color default=#form.color#>
</cflock>
<
!--- Lock the Application scope variable application.number to
update the total number of turtlenecks sold. --->
<cflock scope="Application"
timeout="30" type="Exclusive">
<cfset application.number=application.number + 1>
</cflock>
<!--- Show the form only if it has not been submitted. --->
<cfelse>
<form action="cflock.cfm" method="Post">
<p> Congratulations! You have just selected
the longest-wearing, most comfortable turtleneck
in the world. Please indicate the color and size
you want to buy.</p>
Examples of cflock
341

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion mx

Table of Contents