be used or copied only in accordance with the terms of such license. The content of
this manual is furnished for informational use only, is subject to change without
notice, and should not be constru ed as a commitm ent by Macrom edia, Incorpor ated.
Macromedia, Incorporated assumes no responsibility or liability for any errors or
inaccuracies that may appear in this book.
Except as permitted by such license, no part of this publication may be reproduced,
stored in a retrieval system, or transmitted in any form or by any means, electronic,
mechanical, recording, or otherwise, without the prior written permission of
Macromedia, Incorporated.
ColdFusion, HomeSite, and Macromedia are registered trademarks of Macromedia
Incorporation in the United States and internationally. Allaire Spectra, the Allaire
Spectra logo, Generator, Macromedia Generation, and JRun are trademarks of
Macromedia, Incorporated. Java is a trademark of Sun Microsystems, Inc. Microsoft,
Windows, Windows NT, Windows 95, Microsoft Access, and FoxPro are registered
trademarks of Microsoft Corporation. PostScript is a trademark of Adobe Systems Inc.
Solaris is a trademark of Sun Microsystems Inc. UNIX is a trademark of The Open
Group. All other company names, brand names, and product names are trademarks
of their respective holder(s).
Developing ColdFusion Applications describes the process of developing Web
applications using ColdFusion. In the first eight chapters, you can follow the
instructions presented to learn how to create basic ColdFusion applications. Then,
chapters nine through 19 cover various topics of interest in enhancing your
applications. Finally, chapters 20 through 23 explain how to extend ColdFusion’s
capabilities.
Because of the power and flexibility of ColdFusion, you can create many different
types of Web applications of varying complexity. As you become more familiar with
the material presented in this manual, and begin to develop your own applications,
you will want to refer to the CFML Reference for details about various tags and
functions.
Contents
• Intended Audi ence...................................................................................................xvi
• New Features ............................................................................................................ xvi
• Contacting Macromedia............................................................................................x x
xvi About This Book
Intended Audience
Developing ColdFusion Applications is intended for Web application programmers
who are learning ColdFusion orwish to extended their ColdFusion programming
knowledge. It provides a solid grouding in the tools that ColdFusion provides to
develop Web applications. The initial chapters provide e instructions for creating a
basic ColdFusion application and are intended for those who are new to ColdFusion.
Later chapters cover more specific features in greater detail and are intended for
both new ColdFusion programmers and for those who are looking to extend existing
skill.
New Features
The following table lists the new features in ColdFusion 5:
BenefitFeatureDescription
Breakthrough
productivity
Powerful
business
intelligence
capabilities
User-defined functionsCreate reusable functions to
accelerate development.
Query of queries
Easily integrate data from
heterogeneous sour ce s by
merging and querying data in
memory using standard SQL.
Server analysis and
troublshooting
Quickly detect and diagnose
server errors with built-in server
reporting and the new Log File
Analyzer.
Charting engine
Create professional-quality charts
and graphs from queried data
without leaving the ColdFusion
environment.
Enhanced V erity K2 fu ll-text
search
Index and search up to 250,000
documents and enjoy greater
performance.
Reporting interface for
Crystal Reports 8.0
Create professional-quality
tabular reports from queried data
and applications.
Developer Resourcesxvii
BenefitFeatureDescription
Enhanced
performance
Core engine tuning
Take advantage of dramatically
improved server performance and
reduced memory usage to deliver
faster, more scalable applications.
Incremental page delivery
Improve response time by
delivering page output to users as
it is built.
Easy
managment
Wire protocol database
drivers
Application deployment
services
Deliver high-performance ODBC
connectivity using new drivers.
Effortlessly and reliably deploy,
archive, or restore entire
applications using ColdFusion
archive files.
Enhanced application
monitoring
Keep track of server performance
and availability with customizable
alerts and recovery.
SNMP support
Monitor ColdFusion applicatio ns
from enterprise management
systems.
Expanded
integration
Expanded Linux support
Deploy on additional Linux
distributions, including SuSE and
Cobalt.
Enhanced hardware load
balancer integration
Apply optimized, agent-based
support for hardware load
balancers, including new support
for the Cisco CSS 11000.
Enhanced COM support
Experience easier integration with
COM components.
Developer Resources
Macromedia, Inc. is committed to setting the standard for customer support in
developer education, technical support, and professional services. The Web site is
xviii About This Book
designed to give you quick access to the entire range of online resources, as the
following table describes.
ResourceDescriptionURL
Macromedia W eb
site
Information on
ColdFusion
Technical
Support
ColdFusion
Support Forum
Installation
Support
Professional
Education
Developer
Community
ColdFusion Dev
Center
Macromedia
Alliance
General inf ormation about Macrom edia
products and services
Detailed product information on
ColdFusion and related topics
Professional support programs that
Macromedia offers .
Access to experienced ColdFusion
developers through participation in the
Online Forums, where you can post
messages and read replies on many
subjects relating to ColdFusion.
Support for installation-related issues
for all Macromedia produc t s
Information about classes, on-s ite
training, and online courses offered by
Macromedia
All the resources that you need to stay
on the cutting edge of ColdFusion
development, including online
discussion groups, Knowledge Base,
technical papers and more
Development tips, articles,
documentation, and white papers
Connection with the growing network of
solution providers, appli ca tio n
developers, resellers, and hosting
services creating solutions with
ColdFusion
ColdFusion documentation is designed to provide support for the comp lete
spectrum of participant s . T he p rint a nd onl ine v e rsions are organized to allow y ou to
quickly locate the information that you need. The C oldF usion online documentation
is provided in HTML and Adobe Acrobat formats.
About ColdFusion Documentationxix
Printed and online documentation set
The ColdFusion documentation set consists of the following titles.
Describes system installation and basic configuration for
Windows NT, Windows 2000, Solaris, Linux, and HP-UX
Describes how to connect your data sources to the ColdFusion
Server, configure security for your applications, and how to use
ClusterCATS to manage scalability, clustering, and
load-bal ancing for your site
Describes on how to develop your dynamic Web applications,
including retrievi ng and u pdating y our dat a, usin g structu res, an d
forms.
syntax, usage, and code examples for all ColdFusion tags,
functions, and variables.
A brief guide that shows the syntax of ColdFusion tags,
functions, and variables
Describes how to use ColdFusion Studio to build, test, and
deploy Web content, including using the built-in editor for a
variety of scripting and markup languages
Viewing online documentation
All ColdFusion documentation is available online in HTML and Adobe Acrobat PDF
formats. To view the HTML documentation, open the following URL on the We b
server running ColdFusion: http://localhost/coldfusio n/docs/dochome.htm.
To view and print ColdFusion documentation in Acrobat format, open the following
URL on the Web server running ColdFusion: http://localhost/coldfusion/docs/
AcrobatDocs/index.htm.
Printing ColdFusion documentation
T o r ead printe d documentation, locate the Ado be Acroba t PDF files installe d with the
product. The PDF files offer excellent print output. You can print an entire book or
individual sections.
Locate the ColdFusion PDF files by opening the following URL on the host system:
http://localhost/coldfusion/docs/AcrobatDocs/index.htm
xx About This Book
Getting Answers
One of the best ways to solve particular programming problems is to tap into the vast
expertise of the ColdFusion developer communities on the ColdFusion Forums.
Other devel opers on th e forum can help y ou f igur e out ho w to do jus t abo ut a nythin g
with ColdFusion. The search facility can also help you search messages from the
previous 12 months, allowing you to learn how others have solved a problem that
you might be facing. The Fo rums is a gr e at r es our ce for learning C oldF u sion, bu t it is
also a great place to see the ColdFusion developer community in action.
Contacting Macromedia
Corporate
headquarters
Technical
support
Sales
Macromedia, Inc.
600 Townsend street
San Francisco, CA 4103
Tel: 415.252.2000
Fax: 415.626.0554
Web: www.macromedia.com
Macromedia offers a range of telephone and Web-based
support options. Go to http://www.coldfusion.com/
support/ for a complete description of technical support
services.
You can make postings to the ColdFusion Support Forum
(http://forums.coldfusion.com/DevConf/index.cfm) at
any time.
This chapter explains the difference between creating static Web pages with HTML
and creating dynamic applications with ColdFusion. It also describes what
ColdFusion is and how it works.
Contents
• A Quick Web Overview................................................................................................2
• Before You Begin .........................................................................................................3
• What is ColdFusion?............................... ...... ....... ...... ....... ...........................................4
• ColdFusion Features and Components.....................................................................5
• How ColdFusion Server Works................................................................................... 8
2Chapter 1 Introduction to ColdFusion
A Quick Web Overview
Over the last few years, the Web changed from being simply a collection of static
HTML pages to an application development platform. Rather than offering a space
where organizations can merely advertise goods and services, similar to traditional
yellow pages directories, companies conduct business ranging from e-commerce to
managing internal business processes. For example, a static HTML page allows a
bookstore to publish its location, list services such as the ability to place special
orders, and advertise upcoming events like book signings. A dynamic site for the
same bookstore allows customers to order books online, write reviews of books they
read, and even get suggestions for purchasing books based on their reading
preferences.
ColdFusion is a rapid application development environment that lets you build
dynamic sites. You can use the W e b to h andle bu sin ess tr ans actions and con duct the
day-t o - da y bu siness of your organiza t i on.
Before You Begin3
Before You Begin
Before you begin using ColdFusion to create your Web applications, you should be
familiar with HTML, relational database design and management, and Structured
Query Language (SQL).
HTML
You will find that ColdFusion tags (CFML) are similar in syntax to HTML tags, yet,
unlike HTML, they enable you to crea te dy namic Web pages. You should understand
how to create a basic HTML page, put information into tables, gather data in forms,
and create links.
Relational database design and management
If you plan on creating applications that use data from existing data sources, you
should understand how the data is organized. In most cases, this means
understanding how tables are organized to prevent unnecessary duplication of data.
For example, if you have data about employees, rather than repeating the
department number and name in each employee’s record, you most likely have a
separate table that lists each department number and name just once.
SQL
Familiarity with some SQL is helpful as you develop y our C oldFu sion application s . In
particular, you should be able to use the SELECT, UPDATE , INSERT, and DELETE
statements, as well as WHERE clauses and Boolean logic operators.
4Chapter 1 Introduction to ColdFusion
What is ColdFusion?
ColdFusion lets you create page-based Web applications using ColdFusion Markup
Language (CFML), the tag-based language you use to create server-side scripts that
dynamically control data integration; application logic; and user interface
generation. ColdFusion Web applications can contain XML, HTML, and other client
technologies such as CSS and JavaScript.
ColdFusion application pages are different from static HTML pages in the following
ways:
• They are saved and referenced with a specifi c file extension.
• The default ColdFusion file extension is cfm.
• They contain ColdFusion Markup Language.
Editions of ColdFusion
There are two editions of ColdFusion: Enterprise and Professional. Using ColdFusion
Enterprise or Professional Edition and ColdFusion Studio, you can build Web
applications that leverage existing technologies and busines s sy stems such as
RDBMS, messaging se rvers, file r epo sitories, d irect ory servers, and d istributed ob ject
middleware. ColdFusion Enterprise also offers advanced security features, load
balancing, server failover, and visual cluster administration.
ColdFusion Feature s and Comp one nts5
ColdFusion Features and Components
ColdFusion provides a comprehensive set of features and components for
developing and managing your Web applications. Usin g th e ColdFusion
components, you can enhance the speed and ease of development, dynamically
deploy your applications, integrate new and legacy technologies, and build secure
applications.
About the features
The following table des cribes the C oldfF usion featur es that let you manage y our Web
site:
BenefitsFeatures
Rapid
development
Scalable
deployment
• A tag-based server scripting language that is powerful and
intuitive
• Two-way visual programming and database tools
• Remote interactive debugging for quickly identifying and fixing
problems
• Web application wizards to automate common development
tasks
• Source control integration to enable team development
• Secure file and database access using HTTP for remote
development
• A tag-based component architecture for flexible code reuse
• A multithreaded service architecture that scales across
processors
• Database connection pooling to optimize database performance
• Just-in-time page compilation and caching to accelerate page
request processing
• Dynamic load balancing for scalable performance in a cluster
environment (Enterprise Editi on only)
• Automatic server recovery and failover for high availability
(Enterprise Edition only)
6Chapter 1 Introduction to ColdFusion
BenefitsFeatures
Open integration • Database connectiv ity us in g na tiv e d atabase drivers (Enterprise
Edition only), ODBC, or OLE DB
• Embedded support for full-text indexing and searching
• Standards-based in tegration with directory, mail, HTTP, FTP, and
file servers
• Connectivity to distributed object technologies, including
CORBA (Enterprise Edition only), COM (Windows Enterprise
Edition only), Java objects and EJBs
• Open extensibility with C/C++ and Java
Security• Integration with existing authentication systems, including
Windows NT domain and LDAP directory servers, and
proprietary user and group databases
• Advanced access control so that server administrators can
control developers’ access to files and data sources
• Support for existing database security
• Server sandbox security for protecting multi ple ap plicat ions on a
single server (Enterprise Edition only)
• Support for existing Web server authentication, security, and
encryption
For detailed information about security, see Advanced ColdFusion Administration.
For the latest publications from Macromedia on security, visit the Security Zone at
http://www.coldfusion.com/developer/securityzone/.
For a complete feature list and more detailed information, see the ColdFusion
product pages at http://www.coldfusion.com/coldfusion.
About the components
ColdFusion applications rely on several core components:
• ColdFusion application pages
• ColdFusion Server
• ColdFusion Administrator
• ODBC data sources and other data source s
In addition to the core components, as you become more familiar with ColdFusion
and build more complex applications, you can use ColdFusion Extensions to extend
its capabilities.
ColdFusion application pages
ColdFusion application pages (often called templates) look somewhat like HTML
pages, but are much more dynamic and powerful. They are the functional parts of a
ColdFusion application, including the user interface pages and forms that handle
ColdFusion Feature s and Comp one nts7
data input and format data output. They can contain ColdFusion (CFML) tags,
HTML tags, CFScript, JavaScript, and anything else that you can normally embed in
an ordinary HTML page. You can easily access data sources, such as relational
databases, from your application pages. The default file extension used for
ColdFusion application pages is cfm.
CFML
CFML is a tag-based server scripting language that encapsulates complex processes,
such as connecting to databases and LDAP servers, and sending e-mail. The core of
the ColdFusion deve lopment platf orm language is mor e tha n 70 server- side tags and
more than 200 functions.
ColdFusion Server
ColdFusion Server listens for requests from the Web server to process ColdFusion
application pages. It runs as a service under Windows NT and as a process under
UNIX.
For information on installing and configuring ColdFusion Server, see Installing and Configuring ColdFusion Server.
ColdFusion Administrator
Data sources
Y o u use the Adm inistr ato r to configure various ColdFusion Server options , inclu ding:
• ColdFusion data sources
• Debugging output
• Server settings
• Application security
• Server clustering
• Scheduling page ex ecu t ion
• Directory mapping
For details on using the Administrator, see Advanced ColdFusion Administration.
ColdFusion applications can interact with any database that supports the ODBC
standard. However, ColdFusion is not limited to ODBC data sources. You can also
retrieve data us ing OLE-DB, native da tabase drivers , or dir ectory servers that su pport
the Lightweight Directory Access Protocol (LDAP). You can also retrieve data from
mail servers that support the Post Office Protocol (POP), and index the data in Verity
collections.
8Chapter 1 Introduction to ColdFusion
How ColdFusion Server Works
Regardless of which ColdFusion Server you have installed, ColdFusion application
pages are processed on the server at runtime, each time they are requested by a
browser.
A page request happens when you click a Web site link to open a Web page in your
browser. When you request a ColdFusion application page, ColdFusion Server
processes the request, retrieves any data if necessary, and routes the data through
the Web server, back to your browser.
The following steps describe in more detail what happens when you open a
ColdFusion page:
1 The client requests a page that contains CFML tags.
2 The Web server passes files to ColdFusion Server if a page request contains a
ColdFusion file extension.
3 ColdFusion Server scans the page and proce sses all CFML tags.
4 ColdFusion Server then returns only HTML and other client-side technologies to
the W e b server.
5 The Web server passes the page back to the browser.
Chapter 2
Writing Your First Co ldFusion
Application
This chapter guides you through the ColdFusion development process as you create
a ColdFusion application page, save it, and view it in a browser.
Contents
• The Development Process........................................................................................10
• Working with ColdFusion Application Pa ges.......................................................... 10
• Wor king with Variables............................................. ....... ....... ...... ....... ...... ............... 13
• Development Considerations ..................................................................................16
10Chapter 2 Writing Your First ColdFusion Application
The Development Process
Whether you are creating a static HTML page or a ColdFusion application page, you
follow the same iterative process:
1Write some code.
2 Save the code to a document or page.
3 View the page in a browser.
4 Modify the page.
5 Save the page again.
6 View it in a browser.
Working with ColdFusion Application Pages
While you can code your application pages using NotePad or any HTML editor, this
book uses ColdFusion Studio because it provides many features that make
ColdFusion development easier. You should install ColdFusion Studio if you have
not done so already.
About applicaton pages
From a coding perspective, the major difference between a static HTML page and a
ColdFusion application page is that ColdFusion pages contain ColdFusion Markup
Language (CFML). CFML is a markup language that is very similar in syntax to
HTML, so Web developers find it intuitive. Unlike HTML, which defines how things
are displayed and formatted on the client, CFML identifies specific operations that
are performed by ColdFusion Server.
Creating application pages
The following procedure creates a simple ColdFusion Application page, which you
use for other examples in this chapter.
To create a ColdFusion application page:
1Open ColdFusion Studio.
2Select File > New and select the Default Template for your new page.
3 Edit the file so that it appears as follows:
<html>
<head>
<title>Call Department</title>
</head>
<body>
<strong>Call Department</strong><br>
Loading...
+ 408 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.