O'Reilly logo

ColdFusion 9 Developer Tutorial by John Farrar

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

Setting page defaults

The information you will learn here can be applied to more than page defaults. This is likely the most common place you should use it. We are going to make one minor change in the code that we were using in order to make a new page. We will use the<cfparam> tag to set the default values as shown in the following code:

<!--- Example: 1_12.cfm --->
<!--- Processing --->
<cfparam name="url.name" default="( unknown user )">
<!--- Content --->
<cftry>
<cfoutput>
My name is #url.name#.<br />
</cfoutput>
<cfcatch>
<cfdump var="#cfcatch#">
</cfcatch>
</cftry>

Here we see that the default value is displayed in the browser:

Setting page defaults

Now, we have ...

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