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

Data versatility

Another one of the wonderful powers in COOP is the ability to pass different data types and have the view handle them the same way. COOP supports three data types: lists, array of structures, and queries. Let's take a look at them one at a time. For these examples, we will not need a coprocessor. We will start with list data for our first code example using the same view page we have used before, but simplified a bit.

Lists

A list is just a string field with a delimiter separating one data element from the next. We can see that in this example, our string is the _init.persona using the preDOM structure for the persona coop element tag passed in the data attribute. Save this file as dataswap.cfm with the following code:

<cfimport ...

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