The VARIABLES scope is the default scope for an unscoped variable, and 
is shared with the cfincluded page that is called by the onRequest 
method.  The THIS scope only exists in a CFC or in a method of the CFC.  
Since the cfinclude is called in a method, then the THIS scope is 
available in the cfincluded page.

When there is no onRequest method, the page is just executed, and the 
called page, test.cfm, does not have access to any of the cfc variables, 
so VARIABLES scope is empty, and the THIS scope does not exist.


YouSui wrote:
>
> 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