September 2007
Intermediate to advanced
600 pages
20h 21m
English
Application variables are persistent. That simply means that once you create them, they stick around. Because of this, there is no reason to set them on every request. Once you create an Application variable, you don’t need to create it. Once simple way to handle that would be with the isDefined() function.
<cfif not isDefined("APPLICATION.dsn")>
<cfset APPLICATION.dsn = "ows">
</cfif>This code will check to see if the variable, APPLICATION.dsn exists. If it doesn’t, it will create it. However, the Application.cfc component provides an even easier way to do this. One of the special methods mention in Table 19.1 is the onApplicationStart() method. This method will execute only when the application starts. Conversely, ...
Read now
Unlock full access