Let's add the following code to a template called Listing3_30.cfm
in our Chapter_3
directory:
<cfset SERVER.aVariable = "My Lovely Variable">
Now, if you dump the SERVER
scope you should get your variable displayed:
The SERVER
scope is accessible by all the applications and contexts that are on a single instance of Railo Server. This means that if we set any variables here, they can be read (and written) across the server.
In Railo Server, you can define a folder (and of course, its sub folders) as a specific application, with its own settings and data sources using CFML. To do this, you need to put a special file in the root named Application.cfc
. This file has a special type of template called Component (we shall have a more detailed look at the components later in this chapter).