Adobe ColdFusion 8

Defining the application and its event handlers in Application.cfc

The Application.cfc file defines application-wide settings and variables, and application event handlers:

  • Application-wide settings and variables include page processing settings, default variables, data sources, style settings, and other application-level constants.
  • Application event handlers are CFC methods that ColdFusion automatically executes when specific events occur during the lifetime of an application: application start and end, session start and end, request start, execution, and end, and exceptions.

Defining application-level settings and variables

When you create an application, you can set a number of application-wide properties and characteristics, including the following items:

  • Application name
  • Application properties, including Client-, Application-, and Session-variable management options
  • Page processing options
  • Default variables, data sources, style settings, and other application-level constants

This section describes the following topics:

  • Naming the application
  • Setting application properties
  • Setting page processing options

For information on setting default variables, see Setting application default variables and constants in onApplicationStart.

Naming the application

Define the application and give it a name by setting the This.name variable in the Application.cfc initialization section, before the method definitions. By using a specific application name, you define a set of pages as part of the same logical application.

ColdFusion supports unnamed applications, which are useful for ColdFusion applications that must interoperate with JSP tags and servlets. Consider creating an unnamed application only if your ColdFusion pages must share Application or Session scope data with existing JSP pages and servlets. You cannot have more than one unnamed application on a server instance. For more information on using unnamed applications, see Sharing data between ColdFusion pages and JSP pages or servlets.