Using onRequest()

So far we have seen examples of how you can run code before and after a page request, as well as during the startup and end of the application. Another way to modify the behavior of your pages is with the onRequest method. This method is executed after the onRequestStart method, and before the onRequestEnd method. It takes one argument, the template currently being executed. If you don’t actually include the template, using <cfinclude>, then your page won’t show up.

Using this method has some serious drawbacks. The mere existence of this method won’t allow any Flash Remoting or Web Services calls. The method also tends to “leak” variables into the template itself. If all of this sounds confusing, don’t worry. Typically you ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started 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.