ColdFusion Application.cfc Differences For This and Application Scope

Posted: February 11, 2011 in ColdFusion

Thanks to Ray Camden, I learned something new today that was of great help.

Inside the Application.cfc, I always assumed the “this” and “application” scopes where the same. This is incorrect.

“Application” scope will only store name/value pairs. It has no impact on how the application behaves on the server level (built-in behavior).

<cfset application.name = value>

While “this” scope is used to change the behavior of the application itself.  For example: defining custom tag paths and the common datasource name.

<cfset this.name= value>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s