You are previewing Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started.
O'Reilly logo
Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started

Book Description

The ColdFusion Web Application Construction Kit is the best-selling ColdFusion series of all time—the books that most ColdFusion developers used to learn the product. This Getting Started volume starts with Web and Internet fundamentals and database concepts and design, and then progresses to topics including creating data-driven pages, building complete applications, implementing security mechanisms, integrating with e-mail, building reusable functions and components, generating data-driven reports and graphs, building Ajax-powered user interfaces, and much more. Complete coverage of ColdFusion 8 continues in “Volume 2, Application Development” (ISBN 0-321-51546-3) and “Volume 3, Advanced Application Development” (ISBN 0-321-51547-1).

Table of Contents

  1. Copyright
    1. Dedications
  2. Acknowledgments
    1. Ben Forta
    2. Raymond Camden
    3. Charlie Arehart
  3. Biographies
    1. Ben Forta
    2. Raymond Camden
    3. Charlie Arehart
  4. Introduction
    1. Who Should Use This Book
    2. How to Use This Book
  5. Getting Started
    1. Introducing ColdFusion
      1. The Basics
      2. Understanding ColdFusion
        1. The Dynamic Page Advantage
        2. Understanding Web Applications
        3. What Is ColdFusion?
        4. ColdFusion and Your Intranet, Extranet, and Portal
      3. ColdFusion Explained
        1. The ColdFusion Application Server
        2. The ColdFusion Markup Language
        3. Linking to External Applications
        4. Extending ColdFusion
        5. Inside ColdFusion 8
      4. Powered by ColdFusion
    2. Choosing a Development Environment
      1. Using Adobe Dreamweaver
        1. Why Use Dreamweaver for ColdFusion Development
        2. A Brief Introduction to Dreamweaver
        3. Dreamweaver ColdFusion Support
        4. Getting Started
        5. Working with Files
      2. Using Eclipse
        1. Why Use Eclipse for ColdFusion Development
        2. A Brief Introduction to Eclipse
        3. Eclipse ColdFusion Support
        4. Getting Started
        5. Using Perspectives
        6. Working with Files
          1. Creating Files
          2. Saving, Closing, and Opening Files
    3. Accessing the ColdFusion Administrator
      1. Logging Into (and Out of) the ColdFusion Administrator
      2. Using the ColdFusion Administrator
        1. Creating a Data Source
        2. Defining a Mail Server
        3. Enabling Debugging
        4. Viewing Settings
    4. Previewing ColdFusion
      1. Preparing to Learn ColdFusion
      2. Using Dreamweaver Code Generation
        1. Preparing to Create an Application
        2. Creating an Application in Dreamweaver
      3. Trying It Yourself
      4. Browsing the Examples and Tutorials
      5. Conclusion
    5. Building the Databases
      1. Database Fundamentals
        1. Databases: A Definition
        2. Where Are Databases Used?
        3. Clarification of Database-Related Terms
        4. Data Types
      2. Using a Database
        1. A Database Primer
      3. Understanding Relational Databases
        1. Primary and Foreign Keys
        2. Different Kinds of Relationships
        3. Multi-Table Relationships
        4. Indexes
        5. Using Indexes
        6. Indexing on More than One Column
      4. Understanding the Various Types of Database Applications
        1. Shared File–Based Databases
        2. Client/Server–Based Databases
        3. Which Database Product to Use
      5. Understanding the OWS Database Tables
        1. The Films Table
        2. The Expenses Table
        3. The Directors Table
        4. The FilmsDirectors Table
        5. The Actors Table
        6. The FilmsActors Table
        7. The FilmsRatings Table
        8. The UserRoles Table
        9. The Contacts Table
        10. The Merchandise Table
        11. The MerchandiseOrders Table
        12. The MerchandiseOrdersItems Table
    6. Introducing SQL
      1. Understanding Data Sources
      2. Creating a Data Source
      3. Preparing to Write SQL Queries
      4. Creating Queries
      5. Sorting Query Results
      6. Filtering Data
        1. Filtering on a Single Column
        2. Filtering on Multiple Columns
        3. The AND and OR Operators
        4. Evaluation Precedence
        5. WHERE Conditions
    7. SQL Data Manipulation
      1. Adding Data
        1. Using the INSERT Statement
        2. Understanding INSERT
      2. Modifying Data
        1. Understanding UPDATE
        2. Making Global Updates
      3. Deleting Data
  6. Using ColdFusion
    1. The Basics of CFML
      1. Working with Templates
        1. Creating Templates
        2. Saving Templates
        3. Executing Templates
        4. Templates Explained
      2. Using Functions
      3. Using Variables
        1. Variable Naming
        2. Using Prefixes
      4. Working with Expressions
        1. Building Expressions
        2. When to Use #, and When Not To
      5. Using ColdFusion Data Types
        1. Lists
        2. Arrays
        3. Structures
        4. “Dumping” Expressions
      6. Commenting Your Code
    2. Programming with CFML
      1. Working with Conditional Processing
      2. If Statements
        1. Basic If Statements
        2. Multiple-Condition If Statements
        3. If and Else
        4. Multiple If Statements
        5. Putting It All Together
        6. Switch Statements
      3. Using Looping
        1. The Index Loop
        2. The List Loop
        3. Nested Loops
      4. Reusing Code
      5. Revisiting Variables
    3. Creating Data-Driven Pages
      1. Accessing Databases
        1. Static Web Pages
        2. Dynamic Web Pages
        3. Understanding Data-Driven Templates
        4. The Dynamic Advantage
      2. Displaying Database Query Results
        1. Displaying Data Using Lists
        2. Displaying Data Using Tables
      3. Using Result Variables
      4. Grouping Result Output
      5. Using Data Drill-Down
        1. Introducing Dynamic SQL
        2. Implementing Data Drill-Down Interfaces
        3. Displaying Data Using Frames
      6. Debugging Dynamic Database Queries
    4. The Basics of Structured Development
      1. Understanding Structured Development
        1. Single-Tier Applications
        2. Multi-Tier Applications
      2. Introducing ColdFusion Components
        1. Creating Your First CFC
          1. The <cfcomponent> Tag
          2. The <cffunction> Tag
          3. The <cfreturn> Tag
          4. The <cfargument> Tag
        2. Using ColdFusion Components
        3. Using Dreamweaver CFC Support
      3. More On Using ColdFusion Components
        1. Where to Save CFCs
        2. Unit Testing
        3. Documenting ColdFusion Components
    5. ColdFusion Forms
      1. Using Forms
      2. Creating Forms
        1. Using HTML Form Tags
        2. Form Submission Error Messages
      3. Processing Form Submissions
        1. Processing Text Submissions
        2. Processing Check Boxes and Radio Buttons
        3. Processing List Boxes
        4. Processing Text Areas
        5. Processing Buttons
      4. Creating Dynamic SQL Statements
      5. Building Truly Dynamic Statements
        1. Understanding Dynamic SQL
        2. Concatenating SQL Clauses
      6. Creating Dynamic Search Screens
    6. Form Data Validation
      1. Understanding Form Validation
        1. Comparing Server-Side and Client-Side Validation
        2. Pros and Cons of Each Option
      2. Using Server-Side Validation
        1. Using Manual Server-Side Validation
        2. Using <cfparam> Server-Side Validation
        3. Using Automatic Server-Side Validation
      3. Using Client-Side Validation
        1. Understanding Client-Side Validation
        2. Client-Side Validation Via <cfform>
        3. Extending <cfinput> Validation Options
        4. Specifying an Input Mask
        5. Validation on the Server and Client
        6. Preventing Multiple Form Submissions
      4. Putting It All Together
    7. Using Forms to Add or Change Data
      1. Adding Data with ColdFusion
        1. Creating an Add Record Form
        2. Processing Additions
      2. Introducing <cfinsert>
        1. Controlling <cfinsert> Form Fields
        2. Collecting Data for More Than One INSERT
        3. <cfinsert> vs. SQL INSERT
      3. Updating Data with ColdFusion
        1. Building a Data Update Form
        2. Processing Updates
      4. Introducing <cfupdate>
        1. <cfupdate> vs. SQL UPDATE
      5. Deleting Data with ColdFusion
      6. Reusing Forms
      7. Creating a Complete Application
    8. Beyond HTML Forms: ColdFusion-Powered Ajax
      1. Using the Extended Controls
        1. ColdFusion Extended Form Controls
      2. Working with Ajax
      3. Using Bindings
    9. Graphing, Printing, and Reporting
      1. Generating Graphs
        1. Building Simple Charts
        2. Formatting Your Charts
        3. Using Multiple Data Series
        4. Drilling Down from Charts
        5. Additional Charting Topics
          1. Plotting Individual Points with <cfchartdata>
          2. Using Charts with Flash Remoting
      2. Creating Printable Pages
        1. Using the <cfdocument> Tag
        2. Controlling Output Using the <cfdocumentitem> Tag
        3. Defining Sections with <cfdocumentsection>
      3. Generating Reports
        1. Understanding the ColdFusion Report Builder
        2. Using the Setup Wizard
        3. Introducing the ColdFusion Report Builder
        4. Using the Report Wizard
        5. Running Your Reports
        6. Invoking Reports from Within ColdFusion Code
        7. And a Whole Lot More, Too
    10. Debugging and Troubleshooting
      1. Troubleshooting ColdFusion Applications
        1. Understanding What Can Go Wrong
        2. Debugging Web Server Configuration Problems
        3. Debugging Database Driver Errors
        4. Debugging SQL Statement or Logic Errors
        5. Debugging URL and Path Problems
        6. Debugging Form Problems
      2. Using the ColdFusion Debugging Options
        1. Classic Debugging
        2. Dockable Debugging
        3. Dreamweaver Debugging
        4. Using Debugging Options
        5. Using Tracing
        6. Code Timing
      3. Using the ColdFusion Log Files
      4. Preventing Problems
  7. Building ColdFusion Applications
    1. Planning an Application
      1. Getting Started on Your Application
        1. Defining the Project
        2. Knowing the Players
        3. Fact Finding
      2. Planning the Process
        1. Design Documents
        2. Planning the Testing Phase
      3. While You Are Working
        1. Charting Page Flow
        2. Include Files and Custom Tags
        3. Commenting Style
        4. Naming Conventions
        5. Keeping the Directory Structure in Mind
        6. Moving Targets and Feature Creep
    2. Introducing the Web Application Framework
      1. Using Application.cfc
        1. Placement of Application.cfc
        2. Application.cfc Structure
        3. A Basic Application.cfc Template
        4. Using onRequestEnd()
      2. Using Application Variables
        1. What Are Application Variables?
        2. When to Use Application Variables
        3. Using the Application.cfc Component
        4. Using Application Variables
        5. Initializing Application Variables
        6. Putting Application Variables to Work
      3. Customizing the Look of Error Messages
        1. Introducing the <cferror> Tag
        2. Request vs. Exception Error Templates
        3. Creating a Customized Request Error Page
        4. Additional ERROR Variables
        5. Creating a Customized Exception Error Page
        6. Using the OnError Method
      4. Handling Missing Templates
        1. Using onMissingTemplate
        2. Special Considerations
      5. Using Locks to Protect Against Race Conditions
        1. What Is a Race Condition?
        2. <cflock> Tag Syntax
        3. Using Exclusive Locks
        4. Using ReadOnly Locks
        5. Using Named Locks instead of SCOPE
        6. Nested Locks and Deadlocks
        7. Locking with ColdFusion 5 and Earlier
      6. Application Variable Timeouts
        1. Adjusting Timeouts Using APPLICATIONTIMEOUT
        2. Adjusting Timeouts Using the ColdFusion Administrator
        3. Using onRequest()
    3. Working with Sessions
      1. Addressing the Web’s Statelessness
        1. The Problem of Maintaining State
        2. Solutions Provided by ColdFusion
        3. Choosing Which Type of Variables to Use
      2. Using Cookies to Remember Preferences
        1. Introducing the COOKIE Scope
        2. A Simple Cookie Exercise
        3. Using Cookies
        4. Gaining More Control with <cfcookie>
        5. Sharing Cookies with Other Applications
        6. Cookie Limitations
      3. Using Client Variables
        1. How Do Client Variables Work?
        2. Enabling Client Variables
        3. Using Client Variables
        4. Deleting Client Variables
        5. Adjusting How Client Variables Are Stored
        6. Using Client Variables Without Requiring Cookies
        7. Storing Complex Data Types in Client Variables
      4. Using Session Variables
        1. What Are Session Variables?
        2. Enabling Session Variables
        3. Using Session Variables
        4. Using Session Variables for Multiple-Page Data Entry
        5. When Does a Session End?
        6. Using Session Variables Without Requiring Cookies
        7. Other Examples of Session Variables
      5. Working with onSessionStart and onSessionEnd
      6. Locking Revisited
        1. Sessions and the <cflock> Tag
  8. Appendixes
    1. Installing ColdFusion and Development Environments
      1. ColdFusion 8
        1. The Different Flavors of ColdFusion 8
        2. Preinstallation Checklist
        3. Choosing Your Hardware
        4. Checking Your Web Server
        5. Installing ColdFusion on Windows and MAC OS X
        6. Installing ColdFusion on Linux and Unix
      2. Installing the ColdFusion Report Builder
      3. Dreamweaver CS3
      4. Eclipse
      5. Samples and Data Files
        1. What to Install
        2. Installing the OWS Files
    2. Sample Application Data Files
      1. Sample Application Data Files
        1. The Actors Table
        2. The Contacts Table
        3. The Directors Table
          1. Primary Key
          2. Foreign Keys
        4. The Expenses Table
        5. The Films Table
          1. Primary Key
          2. Foreign Keys
        6. The FilmsActors Table
        7. The FilmsDirectors Table
        8. The FilmsRatings Table
        9. The Merchandise Table
        10. The MerchandiseOrders Table
        11. The MerchandiseOrdersItems Table
        12. The UserRoles Table
          1. Primary Key
          2. Foreign Keys
  9. Interacting with Email
    1. Sending Email from ColdFusion
      1. Introducing the <cfmail> Tag
      2. Specifying a Mail Server in the Administrator
      3. Sending Email Messages
      4. Sending Data-Driven Mail
      5. Sending HTML-Formatted Mail
      6. Adding Custom Mail Headers
      7. Adding Attachments
      8. Overriding the Default Mail Server Settings
    2. Retrieving Email with ColdFusion
      1. Introducing the <cfpop> Tag
      2. Retrieving the List of Messages
      3. Receiving and Deleting Messages
      4. Receiving Attachments
      5. Creating Automated POP Agents
  10. Online Commerce
    1. Building E-commerce Sites
      1. Common Commerce-Site Elements
      2. Using a Secure Server
    2. Creating Storefronts
      1. Displaying Individual Items
      2. Collecting Items into a Store
    3. Creating Shopping Carts
      1. Storing Cart Information
      2. Building a Shopping Cart
      3. Encapsulating the Shopping Cart in a Custom Tag
      4. A ColdFusion Component Version of the Shopping Cart
    4. Payment Processing
      1. Payment-Processing Solutions
      2. Processing a Payment
      3. Processing a Complete Order
      4. Creating the Checkout Page
    5. Other Commerce-Related Tasks
      1. Order Tracking
      2. Order Fulfillment
      3. Cancellations, Returns, and Refunds
      4. Inventory Tracking
      5. Reporting
  11. Securing Your Applications
    1. Options for Securing Your Application
      1. SSL Encryption
      2. HTTP Basic Authentication
      3. Application-Based Security
      4. ColdFusion’s <cflogin> Framework
      5. ColdFusion Sandbox Security
      6. Operating System Security
    2. Using ColdFusion to Control Access
      1. Deciding What to Protect
    3. Using Session Variables for Authentication
      1. Checking and Maintaining Login Status
      2. Restricting Access to Your Application
      3. Creating a Login Page
      4. Verifying the Login Name and Password
      5. Personalizing Based on Login
      6. Being Careful with Passed Parameters
      7. Other Scenarios
      8. Using ColdFusion’s <cflogin> Framework
      9. Tags and Functions Provided by the <cflogin> Framework
      10. Using <cflogin> and <cfloginuser>
      11. Using getAuthUser() in Your Application Pages
      12. Using Roles to Dynamically Restrict Functionality
    4. Using Operating System Security
    5. Defending Against Cross-Site Scripting