To define an Application, we need to create a special template called Application.cfc
in the root of our HelloApp
folder. This template manages our application lifecycle and various other settings that we can use within our application. Let's define it now:
1. In the
HelloApp
folder, create a file calledApplication.cfc
with the following code:<cfcomponent output="false"> <cfset this.name = "RememberName"> <cfset this.sessionmanagement = true> </cfcomponent>
In this template, we have simply defined a component with the
<cfcomponent>
tag. Inside this tag, we set two variables:this.name="RememberMe"
, which will be the name of our application, separating it out from other applications on the server, and this.sessionmanagement = true, which sets whether this application will manage sessions or not. By setting it to true, we now have access to theSession
scope.2. In the form, re-enter your name and submit the form...