To demonstrate how this works, let's see what is in the request, include another file, set variables there and see what we end up with. Let's get started:
1. In the index.cfm file you created, put the following code:
<cfdump var="#REQUEST#" label="Initial request"> <cfset REQUEST.myNewVar = "Hello there!"> <cfdump var="#REQUEST#" label="Now with our added variable"> <cfinclude template="included.cfm">
2. Now, let's create another file in which we'll include the
<cfinclude>
tag. We'll name it asincluded.cfm
and put the following code inside it:<cfdump var="#REQUEST#" label="Showing the request scope in an included file">
3. Save the file and now run it in the web browser by going to
http://localhost:8888/myApp
; we should see the following: