Welcome!

AJAX & REA Authors: John Funnell, Bob Little, Kevin Hoffman, Maureen O'Gara, Onkar Singh

Related Topics: ColdFusion

ColdFusion: Article

Test Driving ColdFusion 8

AJAX functionality combined with the simplicity of a tag-based language

When building RSS applications in earlier versions of ColdFusion you had to perform the XML to query conversion manually, i.e., in CFML code, which usually meant writing dozens if not hundreds of lines of code to parse the XML, extract the desired data, and then convert it into something useful like a query result. Of course, in ColdFusion MX applications the developer could have used one of the freely available CFCs written for this purpose.

My favorite news feed CFC is (or was) Ray Camden's "rss.cfc," which can be found at http://cfrss.riaforge.org/. However, even this CFC consists of hundreds of lines of CFML code. I prefer having this functionality in a single ColdFusion tag because the implementation is a lot cleaner and simpler (sorry, Ray!). I think that the presence of the <CFFEED> tag in ColdFusion 8 will encourage novice developers to start building applications that consume, generate, or otherwise incorporate news feeds.

The <CFFEED> tag is clearly an important and powerful addition to the ColdFusion tag arsenal and ColdFusion 8 should give a tremendous boost to developers who want to work with news feeds in their applications. In my opinion, the <CFFEED> tag is right up there with other powerful and versatile ColdFusion tags such as <CFHTTP>, <CFFILE>, and <CFFTP>. It offers tremendous functionality in a single tag that would otherwise require many lines of code. The best things really do come in small packages, don't you think?

Accidents Will Happen
I want to mention two ColdFusion diagnostic tools that greatly facilitated my exploration of ColdFusion 8. The first was the good old <CFDUMP> tag. It has always been there when I needed it and, boy, did I need it this time. I knew that the <CFFEED> tag returned a query, but I didn't know what the column names would be or which columns contained the data I needed. Without this crucial information it would have been impossible for me to use the <CFFEED> tag at all. This is where <CFDUMP> came to the rescue. I used it to inspect the query that was being returned by the <CFFEED> tag. Once I did this, I found the columns with the data I was interested in: "Title," "Rsslink," and "Publisheddate." With this information in hand, it was then a simple matter to write the necessary code to display the news feed query data in a Web page or even better in an HTML data grid (as shown in Listing 2). The syntax of <CFDUMP> is simple:

<CFDUMP VAR="#myQuery#">

When ColdFusion encounters this code it displays or dumps the entire contents of the "myQuery" variable, including all query rows and columns, in a neatly formatted table. <CFDUMP> is absolutely indispensable when building and troubleshooting ColdFusion applications and, as I discovered, when checking out new ColdFusion tags like <CFFEED>.

The other diagnostic tool I used while exploring the many features of ColdFusion 8 is available only in ColdFusion 8. This is the AJAX debugger that's a window that displays diagnostic information on the status of ColdFusion 8 AJAX components. To make the AJAX debugger window appear, you'll need to enable this option in the ColdFusion 8 Administrator (in the Debug Output Settings page in the Administrator select "Enable AJAX Debug Log Window"). You'll also have to add the "cfdebug" flag as a URL parameter when viewing your page in a browser like this:

http://127.0.0.1/CF8/myAutoSuggestExample.cfm?cfdebug

Once you've done this, ColdFusion 8's AJAX debugger should appear and provide you with detailed real-time information about the status of your code. The diagnostic information includes error descriptions, debugging information, and feedback on what the AJAX component is doing at any given moment. While experimenting with Auto-Suggest, I noticed that the debugger was displaying real-time information about every CFC invocation made by the AJAX component and listing the values of all data being returned by the CFC. This is extremely useful information to have on hand if you're troubleshooting a problem, or even if you're just trying to learn the basics of how AJAX components function in ColdFusion 8.

Conclusion I'm very impressed with ColdFusion 8 because it will greatly simplify difficult time-consuming programming tasks and make them less intimidating and more approachable for developers, especially beginners. With ColdFusion 8 it appears that AJAX will no longer be the exclusive realm of the coding masters. Mere mortals like me will be able to leverage AJAX components to build sophisticated user interfaces quickly and with relatively little effort. The AJAX components are built right into the language and are readily available via tags. All we developers have to do is use the right tags and attributes in our code, and ColdFusion will take care of the rest.

As I've always said, ColdFusion excels at making even complex tasks seem easy, and ColdFusion 8 is no exception. As a developer, the prospect of being able to drop advanced AJAX functionality, RSS feeds, and who knows what else into my ColdFusion applications using good old CFML is very exciting. I can hardly wait to see the look on my users' faces when they type a search term into one of my ColdFusion forms and a list of suggestions magically appears!

When this was written, Adobe hadn't released ColdFusion 8 yet. However, I find myself contemplating all of the cool new features and how I might integrate them into my ColdFusion applications. So, I'm going to wrap up this article with a plea to Adobe: for heaven's sake, please don't make us wait much longer for ColdFusion 8. We need AJAX (and <CFFEED>) now!

•  •  •

Disclaimer: The views expressed in this article are those of the author and do not necessarily reflect the views or policies of the U.S. Environmental Protection Agency (EPA).

More Stories By Michael Markowski

Michael Markowski works for the Air Protection Division at the Environmental Protection Agency and is a Macromedia/Adobe Certified Professional.

Comments (2) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Rich 11/04/07 08:33:09 AM EST

Interesting article on CF8 although not a good example from the link to the EPA site! All I got when trying was this:

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

--------------------------------------------------------------------------------

An invalid character was found in text content. Error processing resource 'http://yosemite.epa.gov/opa/admpress.nsf/RSSByCa...

No. 07-OPA198 CHICAGO (Oct. 25, 2007) - U.S. Environmental Protection Agency recently named the Tri-Cities Wastewater Treatm...

navot 10/05/07 05:13:01 PM EDT

I would like to draw your attention to another alternative which is a paradigm shift for AJAX front ends. One should be aware that I am not, and do not pretend to be objective, never the less I believe that one can judge for himself. Visual WebGui is an open source rapid application development framework for graphic user interfaces of IT web applications. VWG replaces the obsolete paradigms of ASP.NET in both design-time and run-time which were designed for developing sites, with WinForms methodologies, which were designed for developing applications. Thus enabling designer that was designed for application interfaces (WinForms designer) instead of a word documents (ASP.NET designer). This provides the developer with an extremely efficient way to design interfaces using drag and drop instead of hand coding HTML Worth a look at www.visualwebgui.com