CFLib.org – Common Function Library Project

getApplicationName()

Last updated September 16, 2005

author

Steven Maglio

Version: 1 | Requires: CF6 | Library: UtilityLib

Description:
Returns the value of the name attribute. This attribute is set within the cfapplication tag. Usually this application name can be garnered from the application structure (application.applicationname). However, sometimes this value is missing (usually due to a structClear( application ) call).

Return Values:
Returns a string.

Example:

application name =
<cfoutput>#getApplicationName()#</cfoutput>

Parameters:

No arguments.

Full UDF Source:

/**
 * returns the name of the cfapplication.
 * 
 * @return Returns a string. 
 * @author Steven Maglio (smaglio@graddiv.ucsb.edu) 
 * @version 1, September 16, 2005 
 */
function getApplicationName() {
    var name = "";
    var appScopeTracker = createObject("java", "coldfusion.runtime.ApplicationScopeTracker");
    var keys = appScopeTracker.getApplicationKeys();
    var app = 0;
    var appName = 0;
    
    while(keys.hasNext()) {
        appName = keys.next();
        app = appScopeTracker.getApplicationScope(appName);
        if(app.equals( application ) ) return app.getName();
    }
    return "";
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson