ColdFusion, WDDX, and NetObjects Fusion by Tom Molyneux Editor's Note: If you're the kind of Web developer that understands cryptic acronyms and needs all of the power they stand for, then you'll be interested in WDDX. If you aren't highly technical and don't need your Web site to work like a software program, reading this article may give you a headache :)
One of the latest buzzwords in the software industry is "rentalware." The concept is that users will be able to rent software over the Internet instead of forking out large one-time fees for software purchases and upgrades. This promises to do away with the cumbersome distribution of software on CDs and diskettes and the attendant headaches of supporting different operating systems and older versions. While this is a laudable goal, it is currently very difficult to get an application delivered over the 'Net to behave with anything near the speed of a locally installed or client-server application. This is where Allaire's WDDX (Web Distributed Data eXchange) can help. Instead of hitting the server each time a new record is required, WDDX loads entire record sets onto the client's browser. This has two enormous benefits. For the end user, once a record set has been loaded, it is, in essence, working locally, making the application much faster and more responsive. From the developer's standpoint, server requests and database queries may be reduced by
a magnitude of between 3 and 250 times. The best way to demonstrate the benefits of the WDDX approach over the standard, dumb-client approach, is with a case study. I will discuss an overall Web-based application and how we at ExamWeb distributes software on disk and by download. Its software provides test preparation for exams such as the California Real Estate Exam and the LSAT. One of the main features of the software is an exam
simulator that allows students to build and take practice exams on their computers. The stand-alone software is full featured: It tracks time spent on each question and the student's score in each test area (i.e., reading comprehension). It allows the student to analyze many facets of past test performance as well as reload partially taken exams. We were able to capture all of these features using ColdFusion. However, one very practical reason led us to use WDDX for this application:
time. Imagine taking a 250-question exam where you had to hit the server each time you answered a question. Most users without a T1 line would walk away in frustration after the first couple of questions. WDDX solved this problem. The student could make a single request to the server at the start of the exam and then work with the same record set during the next hour without making another server request. (You can see this demonstrated at Development One part of the application was a glossary of real estate terms powered by WDDX. The application works as follows: The page displays a form with letter buttons across the top from A to Z. When the student clicks on a letter, all words beginning with that letter are loaded into the words combo box below. When the user clicks on one of the words, its
definition is displayed below in the definition text area. By loading all of the records at one time using WDDX, we reduce the number of server requests by at least 3 times (the student only gets one form vs. getting one form and submitting it two times.) If the student wants to look up more than one term, the savings is even greater. Best of all, it's fast. To create the glossary, we used NetObjects Fusion to design the form. We created a form using the NetObjects Fusion table tool with a combo box named "words," a text area named "definition," and 26 buttons across the top labeled "A to Z."
We gave each button an event handler, using the HTML Inside Tag feature, coded as onClick="loadCurrentLetter('e');". We also created an event handler for the combo box, coded as onClick="loadCurrentDefinition();". In our work with NetObjects, we did not use the Allaire ColdFusion
Connector. The Connector was designed for common ColdFusion tasks and this is a very custom application. Instead, we used a CFInclude statement to include a ColdFusion template we created in ColdFusion Studio. Our included template contains the ColdFusion code that
creates the WDDX record set and the two JavaScript functions called by our event handlers. We run a query to get all terms and definitions in our glossary table and create a WDDX record set using the CFWDDX tag. If you wish to learn more about WDDX, Ben Forta does an excellent job discussing it in his book ColdFusion 4.0 Application Development. Once we have created our record set, we write two JavaScript functions. The first, loadCurrentLetter('x'),
loads all words beginning with the selected letter into the words combo box. The second, loadCurrentDefinition(), loads the definition for the selected letter into the text area. ColdFusion Code <!---Get all records in glossary table ---> As the Web evolves, more and more software will be distributed as rentalware. Allaire's WDDX can be a tremendous help in creating Web-based applications that behave like local or client-server applications. WDDX is an XML-based technology that enables the exchange of complex data between Web programming languages, creating what some refer to as "Web syndicate networks." WDDX consists of a language-independent representation of data based on an XML 1.0 DTD, and a set of modules for a wide variety of languages that use WDDX. WDDX can be used with HTTP, SMTP, POP, FTP, and other Internet protocols that support transferring textual data. For more information on WDDX, visit http://www.wddx.org/. For more information about Fundere, please contact: |
|
| ||||||||||||||||||||||||||||||||||||