MX is the latest release of the ColdFusion Application Server. It’s also the newest version of Dreamweaver, Fireworks, and Flash. This is the first time Macromedia has bundled these product offerings into one powerful suite. Each product in the MX suite was drastically revamped to be part of this new MX nomenclature. In this article, I’ll address ColdFusion specifically.

Take a closer look at the ColdFusion line of products

ColdFusion MX and Java
Flash Remoting components
ColdFusion Web services

So what’s new?
In terms of ColdFusion, what’s changed with MX? The MX engine was built on a completely different platform. Prior versions of the engine were written in C, but this new engine was written in Java, bringing ColdFusion to the J2EE table. There are new tags available; some replace older tags; others add functionality we’ve all been yearning for; and yet more keep ColdFusion current with today’s technology landscape.

ColdFusion has always been an OS-friendly platform, supporting Windows (9x, NT, 2000, and XP), Linux, HP UX, Solaris, and Mac. With the inclusion of J2EE support, MX finds itself in the company of IBM WebSphere and BEA WebLogic. In fact, ColdFusion CDs now ship with WebSphere as a result of a partnership between Macromedia and IBM, emphasizing the Java application server industry’s support for ColdFusion. A special version of MX for J2EE application servers brings tighter Java integration to the ColdFusion developing masses.

Graphing and charting
We’ve had charting, officially, since Version 5.0 and unofficially, a little longer than that, thanks to an undocumented CFX tag. If you thought that the <CFGRAPH> tag couldn’t get any better, the <CFCHART> tag will blow you away. New features such as more types of charts, configurable drill down of data, the ability to handle multiple series of data, background batch chart creation, and integration with Flash make <CFCHART> a much more powerful tool.

Now you can generate all kinds of charts: pyramid, cone, pie, bar, line, area, curve cylinder, and more. The ability to explore the data in the chart provides a great way to present information. For example, a pie chart of regional sales figures could, with a click on a slice, drill into specifics for the region, or even into a new graph.

You can use scheduling to generate a large number of graphs or just a single, large one at a predetermined time, to be accessed at a later date. The ability to talk directly to Flash MX lets you create custom graphs and charts in Flash MX and pass the data to them.

Broader XML support
We’ve been using XML for a while now. In Version 5.0, in order to access and manipulate XML data, we had three options: choose one of the many Custom Tags for interfacing with XML data; install and use COM to work directly with the parser itself (this was always my approach with the MS XML parser); or don’t use XML at all. With MX, the XML object or data is parsed into a native ColdFusion object, which can be used like any other ColdFusion variable.

Figure A illustrates how we can access the Parser COM object and then use CFSCRIPT to load the data into a variable—one of many ways to do so. With MX you don’t need to worry about parsing with CFSCRIPT, custom tags, or third-party parsers.

Figure A
Using CFSCRIPT to access a COM object

To create an XML document, you simply enclose it in <CFXML> tags. To parse an existing XML object, you use the XMLParse() function.

As Figure B shows, ColdFusion MX makes XML a lot easier to work with. This helps a great deal in some situations—hosted environments, for example—where you may not have the ability to install a parser or CFX custom tag. Another benefit of the internal XML parser is that there is now one less component installed on the Web server—one less thing to break or fail. You can rest a little easier now.

Figure B
Working with XML in ColdFusion MX

J2EE support
The ColdFusion MX engine was rearchitected to include a J2EE Java Application Server. This move adds functionality, scalability, and power to the existing ease of use and RAD (Rapid Application Development) features of ColdFusion.

This underlying J2EE platform means that ColdFusion templates are compiled into Java byte code when accessed the first time, making them execute much faster on subsequent requests than the equivalent code in ColdFusion 5. In addition, ColdFusion MX is now capable of including JSP tag libraries in CFML templates. Java can be written into the tag libraries and then included in ColdFusion, allowing Java and ColdFusion development to remain separate. Figure C illustrates how easy it is to import a JSP tag library into your application.

Figure C
Using <CFIMPORT> to include JSP tag libraries

It’s that simple. There are actually three attributes to the <CFIMPORT> tag, but only taglib is required. You can also use Java Beans, EJBs, and Java APIs in the same fashion.

A J2EE platform also lets ColdFusion run even more platforms. As mentioned above, a special J2EE version allows ColdFusion to run on such popular application servers as WebLogic, WebSphere, and Sun ONE. This allows greater partnering with Java technologies as well as bridging a gap between ColdFusion developers and Java developers.

Web services
We’ve all heard the buzz about Web services. They have a lot of potential and will certainly revolutionize the way Web applications work. It’s for this reason that ColdFusion MX supports the creation and consumption of Web services. MX is compatible with Microsoft’s .NET through Web services.

The consumption of Web services are, as you would assume, tag based. All you need is to know where the Web service is and what, if any, parameters are required. ColdFusion handles the SOAP aspect of Web services for you. Figure D illustrates the consumption of a Web service. The same procedure in other environments can take more lines of code.

Figure D
Web Service consumption

The <CFINVOKE> tag can be used with or without the optional <CFINVOKEARGUMENT> tags. It is only used if the Web service requires that arguments be sent. Otherwise, you just call it and provide a variable to store the results in. Now you have a local ColdFusion variable with whatever the Web service returned.

Web services are as easy to create as they are to access. Use the <CFCOMPONENT> tag to create Web services that can do anything you need. ColdFusion Components (CFCs) are slightly different from other ColdFusion creations. For one thing, they have a different extension, .cfc, as opposed to the traditional .cfm. CFCs are object-oriented; traditional ColdFusion templates are not. Object orientation is new to ColdFusion. Your code can now provide self-documentation and support, use inheritance, and provide multiple methods within a single template (unlike custom tags, which are one tag, one method), along with method-level security. Figure E illustrates a simple CFC structure.

Figure E
Creating a simple CFC

As you like it
ColdFusion MX is a both a new version of the popular ColdFusion language and an open doorway to much greater capabilities and opportunities for ColdFusion developers. For those who like ColdFusion the way it is, nothing has to change—ColdFusion development remains the same, with the addition of some new tags. For those who want to be more involved in Java development but like the ease of use and RAD aspects of ColdFusion, MX provides a great platform to get into Java without giving up ColdFusion. You can write JSP tag libraries and then use them in your ColdFusion templates.

The new features of ColdFusion MX are Macromedia’s way of staying one step ahead of the competition. ASP and PHP are both great languages with many fine points, but as far as rapidly developing powerful, scalable Web applications, nothing beats ColdFusion. ColdFusion MX offers Web services, XML, and J2EE platform compatibility with very few lines of code and no need to learn a new language or protocol.