该文档说它可以在Administrator ColdFusion映射页面中指定的目录中工作。您是否尝试过在ColdFusion管理员中设置映射以查看该映射是否首先运行?如果可行,但在application.cfc中为每个应用程序设置的this.mappings不起作用,那么可能它是一个错误?!?
编辑: 我测试了亚当的建议,使用expandPath()函数,但是这也不起作用,因为标签库属性必须包含一个恒定值。它不能包含变量或函数。除非您使用ColdFusion管理器中的映射集,否则它不起作用。我使用这个application.cfc尝试了下面的测试。
<cfcomponent>
<cfset this.name = "TestApp" />
<cfset this.loginStorage = "session" />
<cfset this.sessionManagement = true />
<cfset this.setClientCookies = true />
<cfset this.setDomainCookies = false />
<cfset this.sessionTimeOut = CreateTimeSpan(0,12,0,0) />
<cfset this.applicationTimeOut = CreateTimeSpan(1,0,0,0) />
<cfset this.mappings['/CT'] = "C:\apache\htdocs\myProjects\Project1\CustomTags"/>
</cfcomponent>
而这在一个ColdFusion模板:
<cfimport prefix="tag" taglib="#expandpath('/CT')#">
抛出错误:
This expression must have a constant value.
<cfset CT = expandpath('/CT')/>
<cfimport prefix="tag" taglib="#CT#">
抛出错误:
This expression must have a constant value.
This.mappings需要位于Application.cfc的顶部,并且cfimport需要位于页面上。 我已经用cfinclude成功地使用了This.mappings,但没有使用cfimport。 – 2009-06-24 15:17:01