Adobe ColdFusion 8

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 tag with CFC initialization code that sets the Application.cfc This scope variables that correspond to the tag attributes.
  • Put in the onApplicationStart method any code that initializes Application scope variables, and any other 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.
  • Put in the onSessionStart method any code that initializes Session scope variables, and any other application-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.
  • Put in the onRequestStart method any cflogin tag and related authentication code.
  • Put in the onRequest method any code that sets Variables scope variables and add a cfinclude tag that includes the page specified by the method's Arguments.Targetpage variable.
  • Put in the onRequestEnd method any code you have in an OnRequestEnd.cfm page.
  • Consider replacing cferror tags with an onError event method. If you do not do so, put the cferror tags in the CFC initialization code.