Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 332

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
<option>forest green
</select>
</td>
</tr>
<tr>
<td>Select a size.</td>
<td><select type="Text" name="size">
<option>small
<option>medium
<option>large
<option>xlarge
</select>
</td>
</tr>
<tr>
<td></td>
<td><input type="Submit" name="submit" value="Submit">
</td>
</tr>
</table>
</form>
</cfif>
</body>
</html>
Note: In this simple example, the Application.cfm page displays the Application.number variable value. Because the
Application.cfm file is processed before any code on each ColdFusion page, the number that displays after you click the
submit button does not include the new order. One way you can resolve this problem is by using the OnRequestEnd.cfm
page to display the value at the bottom of each page in the application.
Example of synchronizing access to a file system
The following example shows how to use a
protects a
tag from attempting to append data to a file already open for writing by the same tag executing on
cffile
another request.
If an append operation takes more than 30 seconds, a request waiting to obtain an exclusive lock to this code might
time out. Also, this example uses a dynamic value for the
file. As a result, locking access to one file does not delay access to any other file.
<cflock name=#filename# timeout=30 type="Exclusive">
<cffile action="Append"
file=#fileName#
output=#textToAppend#>
</cflock>
Example of protecting ColdFusion extensions
The following example shows how you can build a custom tag wrapper around a CFX tag that is not thread-safe. The
wrapper forwards attributes to the non-thread-safe CFX tag that is used inside a
block to synchronize access to a file system. The
cflock
attribute so that a different lock controls access to each
name
Last updated 1/20/2012
tag
cflock
tag.
cflock
327

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents