YouSui, no idea why "this" is not set when onRequest() is not present, but
if you need access to your application object you are probably better off
doing something like this:
<cffunction name="onApplicationStart" returnType="boolean" output="false">
    <cfset application.app = this>
    <cfreturn true>
</cffunction>

And in your test.cfm

<cfdump var="#application.app#">




2009/7/9 YouSui <[email protected]>

>
>
>
> hi everyone, i was blocked by a coldfusion problem, any suggestions
> are appreciated. now lemme decribe my problem.
>
> i have an Application.cfc in my website root, the content in it is as
> follows:
>
> <cfcomponent output="false">
>    <cffunction name="onRequest" returnType="void">
>        <cfargument name="thePage" type="string" required="true">
>        <cfinclude template="#arguments.thePage#">
>    </cffunction>
> </cfcomponent>
>
> and also i have a cfm template of which the name is test.cfm, it's
> content is listed as follows:
>
> <cfdump var="#variables.this#"><br /><br /><br /><br /><br /><br />
> <cfdump var="#this#">
>
> now if you request the test.cfm, everything is ok, but when i delete
> the onRequest method in Application.cfc and request test.cfm again, it
> complaints that "Element THIS is undefined in VARIABLES. ", i don't
> know why, can anybody explain it? great thanks.
>
> ps:
>
> you can add as many functions into Application.cfc, such as
> onSessionStart, onSessionEnd, onApplicationStart, onApplicationEnd...,
> but if there is not a onRequest method, you request test.cfm and get
> error. i just don't know why.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to