Storing Complex Data In A String - MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual

Table of Contents

Advertisement

Storing Complex Data in a String

Storing Complex Data in a String

The following simple example uses WDDX to store complex data, a data structure
that contains arrays as a string in a Client variable. It uses the
the contents of the structure before serialization and after deserialization. It uses the
HTMLEditFormat
variable. The
trying to interpret (and throwing away) the XML tags in the variable.
<!--- Enable client state management --->
<cfapplication name="relatives" clientmanagement="Yes">
<!--- Build a complex data structure --->
<cfscript>
</cfscript>
A dump of the original relatives structure:<br>
<br>
<cfdump var="#relatives#"><br>
<br>
<!--- Convert data structure to string form and save it in the
<cfwddx action="cfml2wddx" input="#relatives#"
output="Client.wddxRelatives">
The contents of the Client.wddxRelatives variable:<br>
<cfoutput>#HtmlEditFormat(Client.wddxRelatives)#</cfoutput><br>
<br>
<!--- Now read the data from client scope into a new structure --->
<cfwddx action="wddx2cfml" input="#Client.wddxRelatives#"
output="sameRelatives">
A dump of the sameRelatives structure <br>
generated from client.wddxRelatives<br>
<br>
<cfdump var="#sameRelatives#">
function in a
HTMLEditFormat
relatives = structNew();
relatives.father = "Bob";
relatives.mother = "Mary";
relatives.sisters = arrayNew(1);
arrayAppend(relatives.sisters, "Joan");
relatives.brothers = arrayNew(1);
arrayAppend(relatives.brothers, "Tom");
arrayAppend(relatives.brothers, "Jesse");
client scope --->
tag to display the contents of the Client
cfoutput
function is required to prevent the browser from
353
tag to display
cfdump

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 5

Table of Contents