How to use cfapplication tag in ColdFusion

cfapplication - simple use

Test.cfm



<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfapplication tag example: simple use of cfapplication tag</title>
</head>

<body>
<h2 style="color:Crimson">cfapplication Tag Example</h2>

<cfdump var="#Application#">
<br />

<cfquery name="qAuthors" datasource="#Application.DSName#">
 SELECT COUNT(AuthorID) AS TotalAuthor FROM AUTHORS
</cfquery>
<cfdump var="#qAuthors#" label="qAuthors">
</body>
</html>


application.cfm


<cfapplication 
 name="cfexample"
    clientmanagement="yes" 
    sessionmanagement="yes" 
    sessiontimeout="#CreateTimeSpan(0,0,30,0)#"
    >

<cfset Application.DSName="cfbookclub">
<cfset Application.Description="ColdFusion Example">







More ColdFusion examples