【问题标题】:"The specified CFC search could not be found"“找不到指定的 CFC 搜索”
【发布时间】:2014-05-29 12:46:41
【问题描述】:

我们有自己的服务器来处理应用程序。我们开始使用不同的提供商进行托管,现在我们遇到了上述错误。

相同的页面上,这是可行的:

<cfset compTest = createObject("component", "components.search")>
<cfset result = compTest.search(1,10,1,"desc","")>
<cfdump var="#result#">

但是这个没有

<cfform name="searchResultGridForm">
<cfgrid 
name="searchResultGrid"
bindOnLoad="true" 
bind="cfc:components.search.search({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{searchedWord@keyup})" 
format="html"
selectMode="Row"
selectOnLoad="false"
width="790"
height="290" 
colHeaderAlign="Center"
stripeRows="true"
pagesize="10">
<cfgridcolumn name="fileColor" header="Priority" width="50">
<cfgridcolumn name="idFile" header="ID" width="40">
<cfgridcolumn name="firstName" header="First Name" width="80">
<cfgridcolumn name="lastName" header="Last Name" width="80">
<cfgridcolumn name="email" header="Email" width="100">
<cfgridcolumn name="nextImportantDate" header="Next Important Date" width="70">
<cfgridcolumn name="statusName" header="Status" width="100">
<cfgridcolumn name="historyLastInsert" header="Last Note" width="100">
<cfgridcolumn name="fileAssignedTo" header="Assigned to" width="90">
<cfgridcolumn name="edit" header="Actions" width="60" dataAlign="Center">
</cfgrid>
</cfform>

我们不知道为什么会这样。非常感谢您的帮助

我们使用的路径

我们的应用托管在这里:

/home/[mycompany]/public_html/[appname]/

我们的组件在这里:

/home/[mycompany]/public_html/[appname]/components

我们的 Application.cfg 看起来像:

<cfapplication name="[name goes here]" sessionManagement="yes" sessionTimeout="#createTimeSpan(0,8,0,0)#">


<cfset APPLICATION.db = "[appname]">

<cfset APPLICATION.website_url = "http://[ourURL].com">
<cfset APPLICATION.template_path = "#application.website_url#/template/">
<cfset APPLICATION.localPath = "/home/[mycompany]/public_html/[appname]/">
<cfset APPLICATION.codeAlgorithm = "[specific stuff goes here]">
<cfset APPLICATION.codeEncoding = "[code encoding]">
<cfset APPLICATION.codeKey = "[specific stuff goes here]">

【问题讨论】:

  • 我不确定它是否一直都是绝对必要的,但是,当我使用绑定属性时,只有当 cfc 与使用它的页面位于同一目录中时,我才会成功。
  • 您能否编辑您的评论并显示 cfm 文件在目录中的位置(我看到您在下面的答案中的 cmets 中有一个 cfc 的路径,也将其添加到您的问题中,因为它是有意义的)。需要一些近端视角...
  • 编辑问题以反映我们使用的路径
  • @DanBracuk 我刚刚尝试将测试功能从“组件”文件夹复制到使用它的页面所在的同一文件夹中并且它可以工作。这很好,因为它有效,而不好,因为代码的变化很大。我将组件复制到我拥有页面的同一个地方(啊!),它们似乎正在工作。我很困惑。甚至不确定是否应该继续这样做。
  • 如果您将 cfc 与代码一起保存在您想要的位置,可能会奏效。然后,在您要使用它们的各种文件夹中,创建其他 cfc。在这些文件中,创建真实 cfcs 的实例,并编写从组件文件夹中调用相应方法的方法。有点乱,但至少功能可以在多个目录下使用。

标签: search coldfusion coldfusion-9 cfc


【解决方案1】:

components 是映射目录吗?据此note about "bind"

在 ColdFusion 9 中(仅限 ColdFusion 9,此说明不适用于 ColdFusion 10!),组件路径不能使用映射。 componentPath 值必须是从 Web 根目录或包含当前页面的目录以点分隔的路径。

【讨论】:

  • 我们有它位于 'code'/home/mycompany/public_html/app/components/search.cfc'code' 我们尝试用代码上的点将其指定为 'code'cfc:app.components .search.search'code' 以及 'code'cfc:public_html.app.components.search.search'code' 以及 'code'cfc:mycompany.public_html.app.components.search.search'code' 以及 ' code'cfc:home.mycompany.public_html.app.components.search.search'code' 但我们一直遇到同样的问题
  • 回答你的问题,据我所知它没有被映射。如您所见,我们使用点符号指定路径
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-04
相关资源
最近更新 更多