Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 259

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
Handling errors
Use the
tag on your Application.cfm page to specify application-specific error-handling pages for request,
cferror
validation, or exception errors, as shown in the following example. This way you include application-specific
information, such as contact information or application or version identifiers, in the error message, and you display
all error messages in the application in a consistent manner.
For more information on error pages and error handling, see
Example: an Application.cfm page
The following example shows a sample Application.cfm file that uses several of the techniques typically used in
Application.cfm pages. For the sake of simplicity, it does not show login processing; for a login example, see
Applications" on page 339.
<!--- Set application name and enable Client and Session variables. --->
<cfapplication name="Products"
clientmanagement="Yes"
clientstorage="myCompany"
sessionmanagement="Yes">
<!--- Set page processing attributes. --->
<cfsetting showDebugOutput="No">
<!--- Set custom global error handling pages for this application.--->
<cferror type="request"
template="requesterr.cfm"
mailto="admin@company.com">
<cferror type="validation"
template="validationerr.cfm">
<!--- Set the Application variables if they aren't defined. --->
<!--- Initialize local app_is_initialized flag to false. --->
<cfset app_is_initialized = False>
<!--- Get a read-only lock. --->
<cflock scope="application" type="readonly" timeout=10>
<!--- Read init flag and store it in local variable. --->
<cfset app_is_initialized = IsDefined("Application.initialized")>
</cflock>
<!--- Check the local flag. --->
<cfif not app_is_initialized>
<!--- Application variables are not initialized yet.
Get an exclusive lock to write scope. --->
<cflock scope="application" type="exclusive" timeout=10>
<!--- Check the Application scope initialized flag since another request
could have set the variables after this page released the read-only
lock. --->
<cfif not IsDefined("Application.initialized")>
<!--- Do initializations --->
<cfset Application.ReadOnlyData.Company = "MyCompany">
<!--- and so on --->
<!--- Set the Application scope initialization flag. --->
<cfset Application.initialized = "yes">
"Handling
Last updated 1/20/2012
Errors" on page 275.
254
"Securing

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents