User Guide

Table Of Contents
275
CHAPTER 13
Designing and Optimizing a
ColdFusion Application
This chapter describes the elements that make your ColdFusion pages into an effective Internet
application. It provides an overview of application elements, describes how you can structure an
application on your server, and provides detailed information on using the Application.cfc and
Application.cfm files. It also describes coding methods for optimizing application efficiency.
Contents
About applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Elements of a ColdFusion application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Structuring an application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Defining the application and its event handlers in Application.cfc . . . . . . . . . . . . . . . . . . . . . 282
Migrating from Application.cfm to Application.cfc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Using an Application.cfm page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Optimizing ColdFusion applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
About applications
The term application can mean many things. An application can be as simple as a guest book or as
sophisticated as a full Internet commerce system with catalog pages, shopping carts, and
reporting.
n application, however, has a specific meaning in Macromedia ColdFusion MX. A ColdFusion
application has the following characteristics:
It consists of one or more ColdFusion pages that work together and share a common set of
resources.
All pages in the application share an application name and configuration settings as specified in
an Application.cfc file or a
cfapplication tag.
All pages in the application share variables in the Application scope.
You can write application-wide event handlers for specific events, such as request start or
session end.