Inside Coldfusion MX
Using CFDUMP
Before we get into our discussion about complex data types, we need to discuss a tool that will help you verify each test that will be run. That tool is ColdFusion's CFDUMP tag. CFDUMP was added to ColdFusion with the release of version 5. It quickly became the best friend of many ColdFusion developers. CFDUMP was migrated into the ColdFusion tag set from Spectra, where it was known as CFA_DUMP. CFDUMP displays the contents of both simple and complex variables. With CFDUMP, you can view the contents of a query object, a list, an array, a structure, or a Web Distributed Data eXchange (WDDX) packet. You can even access memory structures, such as the session, application, server, cookie, common gateway interface (CGI), form, and request scopes. CFDUMP displays the values of these simple and complex data types in a table formatted in Hypertext Markup Language (HTML). Different data types have their own color borders. All structures have a blue border, while all query objects have a red border. See Table 7.1 for more information.
CFDUMP is a tag that is an indispensable tool for code debugging. You simply call the CFDUMP tag within your template and the resulting data is displayed. The syntax for this tag is the following: <cfdump var="#variablename#"> CFDUMP is often used in conjunction with the CFABORT tag to stop the processing of a template right after the CFDUMP tag call: <cfdump var="#variablename#"><cfabort> Let's look at the tag in real code, as in Listing 7.1. Listing 7.1 Using CFDUMP to Access the Server Memory Structure Values
These are the contents of my server memory structure:<br> <br> <cfdump var="#server#"> The resulting output might look something like Figure 7.1: Figure 7.1. The output can be contracted by clicking the lighter-shaded structure key.
|