Rolling Your Own CFPAUSE Tag

Somehow it came to my attention recently that BlueDragon supports a CFPAUSE tag. According to the documentation:

The CFPAUSE tag allows you to pause the execution of a page for a specified number of seconds. The interval attribute is required and must specify an integer value.

I’m not sure why you would want to do this (if your application is just too darn fast?), but if it appeals to you for some reason, and you’re using ColdFusion MX, here is my own CFPAUSE tag:

<cfparam name="attributes.interval" default="1"/><cfscript>thread = createObject("java", "java.lang.Thread");thread.sleep(javaCast("long", 1000*attributes.interval));</cfscript>

Here is the dynamic new CFPAUSE tag in action:

<cfimport taglib="/cf_tags" prefix="mm"/><html><cflog text="this"/><mm:pause interval="5"/><cflog text="is"/><mm:pause interval="5"/><cflog text="slow"/></html>