System information

4 Contents
CHAPTER 5: Lesson 2: Configuring Your Development Environment. . . . . . . . . 49
Exercise 1: Verifying the tutorial file structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Exercise 2: Setting up your development environment. . . . . . . . . . . . . . . . . . . . . . 50
Exercise 3: Configuring a database connection . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Exercise 4: Configuring debugging options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
CHAPTER 6: Lesson 3: Retrieving Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Exercise 1: About the trip list. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Exercise 2: Retrieving the information for the trip list . . . . . . . . . . . . . . . . . . . . . . 61
Exercise 3: Displaying the query result using the cfoutput tag . . . . . . . . . . . . . . . . 62
Exercise 4: Writing structured, reusable code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Exercise 5: Creating additional queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
CHAPTER 7: Lesson 4: Building Dynamic Queries. . . . . . . . . . . . . . . . . . . . . . . . 71
Exercise 1: Creating the trip search form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Exercise 2: Building a query that uses dynamic SQL . . . . . . . . . . . . . . . . . . . . . . . 75
Exercise 3: Constructing the initial Trip Search Results page . . . . . . . . . . . . . . . . . 79
Exercise 4: Testing the Trip Search Results page. . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Exercise 5: Enabling the departure and price criteria on the Trip Search form . . . . 82
Exercise 6: Testing the revised Trip Search Results page . . . . . . . . . . . . . . . . . . . . . 83
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
CHAPTER 8: Lesson 5: Creating a Trip Detail Page. . . . . . . . . . . . . . . . . . . . . . . 85
Exercise 1: Creating a Trip Detail page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Exercise 2: Avoiding the potential security risk when using dynamic SQL. . . . . . . 91
Exercise 3: Linking the Trip Search Results page with the Trip Detail page . . . . . . 92
Exercise 4: Enhancing the look of the Trip Search Results and Trip Detail pages . . 93
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
CHAPTER 9: Lesson 6: Creating a Main Application Page . . . . . . . . . . . . . . . . . 97
Exercise 1: Creating the main application page from the Trip Detail page . . . . . . . 98
Exercise 2: Adding database maintenance buttons . . . . . . . . . . . . . . . . . . . . . . . . 100
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
CHAPTER 10: Lesson 7: Validating Data to Enforce Business Rules. . . . . . . . . 103
Exercise 1: Using an HTML form to collect data. . . . . . . . . . . . . . . . . . . . . . . . . 104
Exercise 2: Creating a simple action page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Exercise 3: About data validation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Exercise 4: Providing server-side validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Exercise 5: Validating data on the client using ColdFusion form tags. . . . . . . . . . 114
Exercise 6: Dynamically populating the list of event types . . . . . . . . . . . . . . . . . . 119
Exercise 7: Validating the existence of the trip photo file . . . . . . . . . . . . . . . . . . . 120
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122