Notes: Integrating Spry and ColdFusion

Session started as a Spry overview.

Faster XML Creation

You can use SQL Server to "earn its keep" by automatically returning XML.

SELECT * FROM myTable FOR XML AUTO

This will return XML nodes for all the fields. Then use the sqlXMLToCFXML function to convert the data quickly into a great XML file that you can use with ColdFusion and Spry.

ColdFusion as an Application Proxy

Browser security doesn't allow cross-domain connections. So, we can use CFHTTP to retrieve the XML/JSON from an external site, then render it on your local server! Nifty!

When to use or not use Spry?

When to use Spry? Dynamic content within an HTML page. Form interaction that has to talk to the server. Long-running requests where you want to leave on-screen feedback before finishing. You want interactively changing datasets.

When not to use Spry? Need to use the back button. User needs to bookmark a specific point in a dataset. Server infrastructure is already experiencing heavy load. Unsure of your audience's browser level (lack of support for JavaScript).

New Spry Support in ColdFusion 8

New tags and functions that will help us do Ajax. SerializeJSON(), DeserializeJSON(), IsJSON().

<cfsprydataset>. Creates a Spry dataset with no JavaScript required!

  • Name
  • Bind: URL of XML or JSON, or even a CFC function.
  • onBindError: Gracefully handle dataset errors.
  • Options: For other JavaScript optional parameters.
  • Type: For determining whether you want to return XML or JSON.
  • XPath: For pulling specific segments of the XML.

Between these new tags and the data binding techniques in the Spry specific HTML attributes, Spry makes your HTML/Ajax feel very Flex-ish.  When you bind the data with the Spry HTML attributes, Spry automatically creates the listeners that look for the dataset to change and automatically update the data. Incredibly awesome. Very small amount of code with great desktop application level data connectivity.

Other Notes

ServiceCapture is an awesome tool for tracking the Ajax calls.  Dowload Spry.
CF8 comes with Spry 1.5, but Adobe will figure out a way to get updates to Spry into CF8.

Leave a Reply

  Theme Brought to you by Directory Journal and Elegant Directory.