O'Reilly logo

Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started by Charlie Arehart, Raymond Camden, Ben Forta

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

A Basic Application.cfc Template

Take a look at Listing 19.1, a simple Application.cfc file. This example makes use of the onRequestStart method. Because the two <cfset> tags are executed before each page request, the dataSource and companyName variables can be referred to within any of the application’s ColdFusion templates. For instance, the value of the dataSource variable will always be ows.

If you save this listing, be sure to save it as Application.cfc, not Application1.cfc.

Listing 19.1. Application1.cfc—A Simple Application Template
<!--- Filename: Application.cfc (The "Application Component") Created by: Raymond Camden (ray@camdenfamily.com) Purpose: Sets "constant" variables and includes consistent header ---> <cfcomponent output="false"> ...

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