Imagine we are sending some data through to a login page in our application within the
URL scope; the first and last name of a particular person. On the page, we want to join the two values and combine them into one string to form the individual's full name. We could write the code directly on the page, as follows:
<cfoutput> Hello, #URL.firstName# #URL.lastName# </cfoutput>
Listing 1.7 - displaying URL variables as a string
Although this works, you can revise the code and transform it into a ColdFusion function to concatenate the two values into the required single string and return that value:
<cffunction name="getName"> <cfset var strFullName = URL.firstName & ' ' & URL.lastName /> <cfreturn strFullName /> ...