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, ...

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.