Adobe COLDFUSION 9 Manual page 257

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
<!--- Some exceptions, including server-side validation errors, do not
generate a rootcause structure. --->
<cfif isdefined("exception.rootcause")>
<cflog file="#This.Name#" type="error"
text="Root Cause Message: #exception.rootcause.message#">
</cfif>
<!--- Display an error message if there is a page context. --->
<cfif NOT (Arguments.EventName IS onSessionEnd) OR
(Arguments.EventName IS onApplicationEnd)>
<cfoutput>
<h2>An unexpected error occurred.</h2>
<p>Please provide the following information to technical support:</p>
<p>Error Event: #EventName#</p>
<p>Error details:<br>
<cfdump var=#exception#></p>
</cfoutput>
</cfif>
</cffunction>
</cfcomponent>
Migrating from Application.cfm to Application.cfc
To migrate an existing application that uses Application.cfm to one that uses Application.cfc, do the following:
• Replace the
cfapplication
correspond to the tag attributes.
• Place in the
onApplicationStart
application-specific code that executes only when the application starts. Often, such code in Application.cfm is
inside a block that tests for the existence of an Application scope switch variable. Remove the variable test and the
Application scope lock that surrounds the code that sets the Application scope variables.
• Place in the
onSessionStart
specific code that executes only when the session starts. Remove any code that tests for the existence of Session
scope variables to be for initialized and the Session scope lock that surrounds the code that sets the Session scope
variables.
• Place in the
onRequestStart
• Place in the
method, any code that sets Variables scope variables and add a
onRequest
the page specified by the Arguments of the method.Targetpage variable.
• Place in the
onRequestEnd
• Consider replacing
cferror
CFC initialization code.
Using an Application.cfm page
If you do not use an Application.cfc file, use the Application.cfm page to define application-level settings and
functions.
tag with CFC initialization code that sets the Application.cfc This scope variables that
method, any code that initializes Application scope variables, and any other
method, any code that initializes Session scope variables, and any other application-
method, any
tag and related authentication code.
cflogin
method, any code you have in an OnRequestEnd.cfm page.
tags with an
event method. If you do not do so, place the
onError
Last updated 8/5/2010
tag that includes
cfinclude
tags in the
cferror
252

Advertisement

Table of Contents
loading

Table of Contents