O'Reilly logo

Programming ColdFusion by Rob Brooks-Bilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Portal Example

Because state management is such an important part of web application development, I think it’s appropriate we end the chapter with an example application that showcases the material we’ve just covered. I’ve opted to create a portal application, that allows a registered visitor to create a personalized home page from a list of prebuilt components, as it is sufficiently complex to allow me to demonstrate a number of techniques. Figure 7-6 shows an overview of how the portal application is put together, including relationships between the various templates. The application uses all the persistent variable scopes we discussed with the exception of the server scope. We’ll cover all of the templates used in the application except for Login.cfm and Validate.cfm. These templates are discussed in Chapter 8.

Application flow for the portal example

Figure 7-6. Application flow for the portal example

Web Application Framework

The Application.cfm template shown in Example 7-2 has four functions in the portal application: it turns on client and session management, handles authentication, expires the session when appropriate, and sets application variables.

Example 7-2. Application.cfm Template for the Portal Application

<CFSETTING ENABLECFOUTPUTONLY="Yes"> <CFAPPLICATION NAME="MyApplication" CLIENTMANAGEMENT="Yes" SESSIONMANAGEMENT="Yes" SETCLIENTCOOKIES="Yes" SESSIONTIMEOUT="#CreateTimeSpan(0, 0, 30, 0)#" APPLICATIONTIMEOUT="#CreateTimeSpan(0, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required