# Understanding the Web Application Framework

A ColdFusion application is a collection of application pages that work together. Applications can be as simple as a guest book or as sophisticated as a full Internet commerce system with catalog pages, shopping carts, and reporting. You can combine individual applications to create advanced Web systems.

You create a special template, named `Application.cfm`, which you place in the root directory of the application. All the other templates in the application are stored in directories below the application's root directory.

The ColdFusion Web Application Framework is based on four basic components:

- Application-level settings and functions
- Client state management
- Custom error handling
- Web server security integration

With these components, you can easily combine your ColdFusion application pages into sophisticated Web applications.

## Application-level settings and functions in Application.cfm

ColdFusion offers application-level features that help you control settings, variables, and features available across the entire application. Once you have defined an application, you can use the application-level features in addition to all of the other features in ColdFusion.

## Client state management

Because the Web is a stateless system, each connection a browser makes to a Web server is unique in the eyes of the Web server. However, within an application it is important to be able to keep track of users as they move through the pages within the application. This is the definition of client state management.

An application maintains client state by seamlessly tracking variables for a browser as the user moves from page to page within the application. This can be used in place of other methods for tracking client state such as using URL parameters, hidden form fields, and HTTP cookies.

ColdFusion creates a client record for each browser that requests an application page in an application in which client state management is enabled. The client record is identified by a unique token that is stored in an HTTP cookie in the user's browser.

The application can then define variables within the client record. These client variables are accessible as parameters in every application page that the client requests within the scope of the application.

## Custom error handling

Using the CFERROR tag, you can display customized HTML pages when errors occur. This allows you to maintain a consistent look and feel within your application even when errors occur. It also allows you to optionally suppress the display of error information.

See "Generating Custom Error Messages (CFERROR)" for more information.

## Web server security integration

You can integrate your applications with the user authentication and security provided by your Web server. In addition, the ColdFusion Server offers a security framework that controls access to applications, pages, data sources, and users. You set the bounds of a security domain using the CFAUTHENTICATE tag.

See Chapter 17, "Application Security" for more information.