Introducing the Application.cfc object
The first thing we need to do is to understand how this application page is called. When a .cfm
or .cfc
file is called, the server looks for an Application.cfc
file in the current directory where the web page is being called from. It also looks for an Application.cfm
file. We do not create an application or session scope with the .cfm
version because .cfc
provides many advantages and is much more powerful than the .cfm
version. It provides better encapsulation and code reuse. If the application file is found, ColdFusion runs it. If the file is not found, then it moves up one directory towards the sever root directory in order to search for an Application.cfc
file. The search stops either when a file is found, or once it reaches the root directory and a file is not found.
There are several methods in the Application.cfc
file. It is worth noting that this file does not exist by default, the developer must create it. The following table gives the method...