Home / Articles / Adobe ColdFusion / Introducing ColdFusion

Introducing ColdFusion

Chapter Description

Before diving into ColdFusion and web-based applications, start with this introduction and see what lies behind this powerful language.

Understanding ColdFusion

Millions of Web sites exist that attract millions of visitors daily. Many Web sites are being used as electronic replacements for newspapers, magazines, brochures, and bulletin boards. The Web offers ways to enhance these publications using audio, images, animation, multimedia, and even virtual reality.

No one will dispute that these sites add value to the Net because information is knowledge, and knowledge is power. All this information is available at your fingertips—literally. Web sites, however, are capable of being much more than electronic versions of paper publications because of the underlying technology that makes the Web tick. Users can interact with you and your company, collect and process mission-critical information in real-time (allowing you to provide new levels of user support), and much more.

The Web is not merely the electronic equivalent of a newspaper or magazine—it is a communication medium that is limited only by the lack of innovation and creativity of Web site designers.

The Dynamic Page Advantage

Dynamic pages (containing dynamic content) are what bring the Web to life. Linking your Web site to live data is a tremendous advantage, but the benefits of database interaction go beyond extending your site's capabilities.

Dynamic Web pages are becoming the norm for good reason. Consider the following:

  • Static Web pages. Static Web pages are made up of text, images, and HTML formatting tags. These pages are manually created and maintained so that when information changes, so must the page. This usually involves loading the page into an editor, making the changes, reformatting text if needed, and then saving the file. Of course, not everyone in the organization can make these changes. The Webmaster or Web design team is responsible for maintaining the site and implementing all changes and enhancements. This often means that by the time information finally makes it onto the Web site, it's out of date.

  • Dynamic Web pages. Dynamic Web pages contain very little text. Instead, they pull needed information from other applications. Dynamic Web pages communicate with databases to extract employee directory information, spreadsheets to display accounting figures, client-server database management systems to interact with order processing applications, and more. A database already exists. Why re-create it for Web page publication?

Creating dynamic pages enables you to create powerful applications that can include features such as these:

  • Querying existing database applications for data

  • Creating dynamic queries facilitating more flexible data retrieval

  • Executing stored procedures (in databases that support them)

  • Executing conditional code on-the-fly to customize responses for specific situations

  • Enhancing the standard HTML form capabilities with data validation functions

  • Dynamically populating form elements

  • Customizing the display of dates, times, and currency values with formatting functions

  • Easing the creation of data entry and data drill-down applications with wizards

  • Generating email automatically (perhaps in response to form submissions)

  • Shopping carts and e-commerce sites

  • Data syndication and affiliate programs

  • ...and much more

Understanding Web Applications

As was explained earlier, Web servers do just that: They serve. Web browsers make requests, and Web servers fulfill those requests—they serve back the requested information to the browser. These are usually HTML files, as well as the other file types discussed previously.

And that's really all Web servers do. In the grand scheme of things, Web servers are actually pretty simple applications—they sit and wait for requests that they attempt to fulfill as soon as they arrive. Web servers do not let you interact with a database; they don't let you personalize Web pages; they don't let you process the results of a user's form submission; they do none of that. All they do is serve pages.

So how do you extend your Web server to do all the things just listed? That's where Web application servers come into play. A Web application server is a piece of software that extends the Web server, enabling it to do things it could not do by itself—kind of like teaching an old dog new tricks. Here's how it all works. When a Web server receives a request from a Web browser, it looks at that request to determine whether it is a simple Web page or a page that needs processing by a Web application server. It does this by looking at the MIME type (or file extension). If the MIME type indicates that the file is a simple Web page (for example, it has an HTM extension) then the Web server fulfills the request and sends the file to the requesting browser as is. But if the MIME type indicates that the requested file is a page that needs processing by a Web application server (for example, it has a CFM extension), the Web server passes it to the appropriate Web application server and returns the results it gets back rather than the actual page itself. Figure 1.6 illustrates this concept (in contrast to simple HTTP processing seen previously in Figure 1.4).

Figure 1.6Figure 1.6 Web servers pass requests to Web application servers, which in turn pass results back to the Web server for transmission to the requesting browser.

In other words, Web application servers are page preprocessors. They process the requested page before it is sent back to the client (the browser), and in doing so they open the door to developers to do all sorts of interesting things on the server, things such as

  • Creating guest books

  • Conducting surveys

  • Changing your pages on the fly based on date, time, first visit, and whatever else you can think of

  • Personalizing pages for your visitors

  • In fact, all the features listed previously

4. What Is ColdFusion? | Next Section Previous Section