我被一个coldfusion问题阻塞了,任何建议都会被赞赏。现在让我记下我的问题。Coldfusion关于Application.cfc中onRequest方法的问题
我有一个Application.cfc
在我的网站的根,它的内容如下:
<cfcomponent output="false">
<cffunction name="onRequest" returnType="void">
<cfargument name="thePage" type="string" required="true">
<cfinclude template="#arguments.thePage#">
</cffunction>
</cfcomponent>
而且我有一个CFM模板,该模板的名称是test.cfm
,它的内容被列为如下:
<cfdump var="#variables.this#"><br /><br /><br /><br /><br /><br />
<cfdump var="#this#">
现在如果你要求test.cfm
,一切正常,但是当我删除onRequest
方法Application.cfc
和请求test.cfm
再次,它投诉"Element THIS is undefined in VARIABLES. "
,我不知道为什么,有人可以解释它吗?万分感谢。
PS:
你可以添加尽可能多的功能集成到Application.cfc
,如onSessionStart
,onSessionEnd
,onApplicationStart
,onApplicationEnd
..., 但如果没有一个onRequest
方法,你要求test.cfm
并得到错误。我只是不知道为什么。
这是不正确的 - 对任何盲目投票未经测试或确切知道它是正确的人都感到羞耻!如果您不包含请求的文件,您将看不到输出。 (请参阅:http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=AppEvents_08.html)或许您正在考虑onRequestEnd事件?你说的onRequestStart是真的。 (请参阅:http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=AppEvents_08.html) – 2009-07-10 18:33:56