O'Reilly logo

Programming ColdFusion MX, 2nd Edition by Rob Brooks-Bilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting Up the Web Application Framework

The first question you might be asking is, “Why do I need an application framework in the first place?” The answer is simple: the Web Application Framework allows you to group your CFML templates logically into a cohesive application or group of applications capable of maintaining state, utilizing constants, handling errors and exceptions, and enforcing security. Sound complicated? It really isn’t. As usual, ColdFusion abstracts the low-level programming that would normally be required to accomplish all of the tasks I just mentioned by providing two templates that serve as the foundation for the Web Application Framework. These templates, named Application.cfm and OnRequestEnd.cfm, are responsible for setting up and controlling every aspect of the Web Application Framework.

The Application.cfm File

In order to use the Web Application Framework, you have to create a template named Application.cfm, a special filename reserved by ColdFusion for use in the Web Application Framework. The initial Application.cfm template (there can be more than one) should be placed in the root directory of your ColdFusion application. Note that the filename is spelled with a capital “A”. This is especially important if you are running ColdFusion for Unix or Linux, where filenames are case sensitive.

When a CFML template is requested, ColdFusion checks to see whether there is an Application.cfm file in the same directory as the requested template. If so, the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required