Application.cfc built-in variables
In ColdFusion version 9, I have the following in Index.cfm:
<cfdump var="#Application#">
But the only thing I'm getting back is a struct with the applicationname - no other variables like rootPath, mappings or customTagPath.
Here's what I have in Application.cfc:
<cfcomponent output="fals开发者_Python百科e">
<cfset this.name = left("App_#hash(getCurrentTemplatePath())#",64)>
<cfset this.applicationTimeout = createTimeSpan(0,8,0,0)>
<cfset this.sessionManagement=True>
<cfset this.loginStorage = "session">
<cfset this.clientManagement = False>
<cfset this.setClientCookies = True>
<cfset this.setDomainCookies = False>
<cfset this.scriptProtect = "all">
<cfset this.rootPath = getDirectoryFromPath(getCurrentTemplatePath())>
<cfset this.mappings = this.rootPath>
<cfset this.customTagPaths = "#this.rootPath#Components">
That's because those settings aren't in the Application Scope. You are confusing Application settings versus Application values. If you want them available in the Application scope, you can simply set them up in your onApplicationStart(). You can also see them via the This scope of course, so you copy the values there.
精彩评论