MACROMEDIA COLDFUSION MX 61-CFML Información técnica Pagina 1

Busca en linea o descarga Información técnica para Software MACROMEDIA COLDFUSION MX 61-CFML. MACROMEDIA COLDFUSION MX 61-CFML System information Manual de usuario

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 152
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente

Indice de contenidos

Pagina 1 - COLDFUSION

COLDFUSION®MX 7Getting Started Building ColdFusion MX Applications

Pagina 3 - CONTENTS

100 Chapter 9: Lesson 6: Creating a Main Application PageReviewing the code The following table describes the navigation code for the Trip Detail pag

Pagina 4

Summary 101To test the updated application:1.Open your browser.2.Enter the following URL to view the updated tripdetail.cfm pagehttp://localhost/cfdoc

Pagina 5 - Contents 5

102 Chapter 9: Lesson 6: Creating a Main Application Page

Pagina 6 - 6 Contents

103CHAPTER 10Lesson 7: Validating Data to Enforce Business RulesIn this lesson, you will create a page for the trip coordinator to add new trip offeri

Pagina 7 - INTRODUCTION

104 Chapter 10: Lesson 7: Validating Data to Enforce Business RulesExercise 1: Using an HTML form to collect dataIn this exercise, you develop the Tr

Pagina 8 - 8 Introduction:

Exercise 1: Using an HTML form to collect data 105<td><select size="1" name="eventType"><option value="1"

Pagina 9 - Welcome to ColdFusion

106 Chapter 10: Lesson 7: Validating Data to Enforce Business Rules <TR> <TD valign="top">Photo File Name</TD> &

Pagina 10

Exercise 2: Creating a simple action page 107At this point, this form does not store any information in the database and does not enforce any business

Pagina 11 - Introducing ColdFusion MX

108 Chapter 10: Lesson 7: Validating Data to Enforce Business RulesExercise 3: About data validationTo ensure that the data entered in the trip edit

Pagina 12 - • ColdFusion data sources

Exercise 4: Providing server-side validation 109Exercise 4: Providing server-side validationIn this exercise, you will learn about the following tasks

Pagina 13

11CHAPTER 1Introducing ColdFusion MXThis chapter introduces the core technologies that are the foundation for Macromedia ColdFusion MX. In addition, i

Pagina 14

110 Chapter 10: Lesson 7: Validating Data to Enforce Business RulesBecause you did not yet add any logic to test whether any values entered in the fo

Pagina 15 - CFML Basics

Exercise 4: Providing server-side validation 111Evaluating check box and radio button variablesBusiness rule 8 in the Compass Travel new trip policy r

Pagina 16 - 16 Chapter 2: CFML Basics

112 Chapter 10: Lesson 7: Validating Data to Enforce Business RulesNote: You have already entered validation code for business rule 1. Validation cod

Pagina 17 - To view the ColdFusion page:

Exercise 4: Providing server-side validation 113Note: The code for business rules 7 and 8 uses ColdFusion cfif and cfelse conditional processing tags.

Pagina 18 - About CFML elements

114 Chapter 10: Lesson 7: Validating Data to Enforce Business RulesTo test the validation code:1.View the tripedit.cfm page in the browser. 2.In the

Pagina 19 - Tag attributes

Exercise 5: Validating data on the client using ColdFusion form tags 115ColdFusion form tags include the following attributes:To use the improved form

Pagina 20 - Functions and parentheses

116 Chapter 10: Lesson 7: Validating Data to Enforce Business RulesModifying the Trip Edit page to use ColdFusion form tagsIn this exercise, you use

Pagina 21 - Nesting functions

Exercise 5: Validating data on the client using ColdFusion form tags 117Tip: For additional help, review the completed code in the ttripedit_lesson7_e

Pagina 22 - 22 Chapter 2: CFML Basics

118 Chapter 10: Lesson 7: Validating Data to Enforce Business Rules5.Open the tripeditaction.cfm file in the my_app directory and delete the code for

Pagina 23

Exercise 6: Dynamically populating the list of event types 119To test the modified code:1.View the tripedit.cfm page in a browser.2.Test the client- a

Pagina 24 - 24 Chapter 2: CFML Basics

12 Chapter 1: Introducing ColdFusion MXThe ColdFusion Markup LanguageColdFusion Markup Language (CFML) is a tag-based language similar to HTML that u

Pagina 25

120 Chapter 10: Lesson 7: Validating Data to Enforce Business Rules4.Replace the following eventtypes code lines:<cfselect size="1" name

Pagina 26 - Arithmetic operators

Exercise 7: Validating the existence of the trip photo file 121For more information about the FileExists function, see CFML Reference.To verify that t

Pagina 27 - About conditional processing

122 Chapter 10: Lesson 7: Validating Data to Enforce Business RulesReviewing the codeThe following table describes the code used to verify whether th

Pagina 28 - Processing form data

123CHAPTER 11Lesson 8: Implementing Browsing and Searching In this lesson, you will further enhance the Compass Travel Macromedia ColdFusion applicati

Pagina 29

124 Chapter 11: Lesson 8: Implementing Browsing and SearchingUsing dynamic SQL to browse the Trips tableThe tripID uniquely identifies a trip in the

Pagina 30 - Commenting your code

Exercise 1: Enabling users to browse trip details 125Limiting the number of result rowsEach of the SQL statements in the preceding table returns a res

Pagina 31 - Database Fundamentals

126 Chapter 11: Lesson 8: Implementing Browsing and SearchingReviewing the codeThe following table describes the code used to process the navigation

Pagina 32 - Field (column)

Exercise 3: Enabling searching from the Trip Detail page 127Exercise 2: Determining actions based on which button a user clicksIn “Lesson 6: Creating

Pagina 33 - About database basics 33

128 Chapter 11: Lesson 8: Implementing Browsing and SearchingReviewing the codeThe following table describes the code that executes when the user cli

Pagina 34 - About SQL

129CHAPTER 12Lesson 9: Enabling Database MaintenanceIn this lesson, you will enable maintenance of the trips database. The exercises will guide you th

Pagina 35 - About SQL 35

Building applications with CFML 13Building applications with CFMLYou build ColdFusion applications as a series of pages that use CFML. Developers can

Pagina 36 - Using SQL with ColdFusion

130 Chapter 12: Lesson 9: Enabling Database MaintenanceThe SQL DELETE statement removes existing rows in a relational table. The DELETE statement has

Pagina 37 - Using SQL with ColdFusion 37

Exercise 2: Adding trips with SQL INSERT statements 131To test the delete capability:1.View the tripdetail.cfm page in a browser. The current trip is

Pagina 38

132 Chapter 12: Lesson 9: Enabling Database MaintenanceFor example, the database table named Clients contains information about people in the followi

Pagina 39

Exercise 2: Adding trips with SQL INSERT statements 133To add data using a SQL INSERT statement and a cfquery tag:1.Open the tripeditaction.cfm file i

Pagina 40

134 Chapter 12: Lesson 9: Enabling Database MaintenanceTo test the modified code:1.Open the tripedit.cfm page in your browser.2.In the tripedit.cfm p

Pagina 41 - Sample Application

Exercise 3: Adding data using the cfinsert tag 135Reviewing the codeThe following table describes the SQL INSERT and cfquery code that ColdFusion uses

Pagina 42

136 Chapter 12: Lesson 9: Enabling Database MaintenanceTo add data using cfinsert:1.Open the tripeditaction.cfm file from the my_app directory in you

Pagina 43

Exercise 4: Updating a SQL row using the cfupdate tag 1373.To verify that the trip was saved, open the tripsearchform.cfm page in the my_app directory

Pagina 44 - Recognizing the data types

138 Chapter 12: Lesson 9: Enabling Database MaintenanceReviewing the codeThe following tables describes the cfinsert and cfupdate code:To update the

Pagina 45

Exercise 6: Inserting values in the edit form 1393.Insert the highlighted code:<cfelseif IsDefined("Form.btnEdit")><!--- Code to ex

Pagina 46

14 Chapter 1: Introducing ColdFusion MX

Pagina 47

140 Chapter 12: Lesson 9: Enabling Database Maintenance<cfset tripDescription = ''><cfset eventTypeIdentifier = #GetEvents.eventTy

Pagina 48

Exercise 6: Inserting values in the edit form 141<TD><cfinput name="departureDate" size="10"required="Yes" vali

Pagina 49 - Development Environment

142 Chapter 12: Lesson 9: Enabling Database MaintenanceReviewing the codeThe following table describes the code that ColdFusion uses to properly init

Pagina 50

143CHAPTER 13Lesson 10: Restricting Access to ColdFusion ApplicationsThis chapter provides information on using the Login Wizard to restrict access to

Pagina 51

144 Chapter 13: Lesson 10: Restricting Access to ColdFusion ApplicationsPreparing to run the Login WizardBefore using the Login Wizard, you should de

Pagina 52

Exercise 1: About the Login Wizard 145Adding user authentication to an existing applicationYou can use the Login Wizard to add user authentication to

Pagina 53

146 Chapter 13: Lesson 10: Restricting Access to ColdFusion ApplicationsCreating a login using simple authenticationWhen you create a Login using sim

Pagina 54

Exercise 2: Requiring users to log in to the Compass Travel application 147Creating a login using Windows NT authentication1.Start the Login Wizard. (

Pagina 55

148 Chapter 13: Lesson 10: Restricting Access to ColdFusion ApplicationsTo test the authentication:1.Open the tripdetail.cfm page in the my_app direc

Pagina 56 - The application form

149INDEXAaction pagescreating 107defined 28actions based on buttons 127addingdatabase maintenance buttons 100navigation buttons 98rows to a table

Pagina 57 - Summary 57

15CHAPTER 2CFML Basics This chapter introduces the basic elements of CFML, including how to create Macromedia ColdFusion pages, and use variables, fun

Pagina 58

150 Indexconditional processing 27, 28, 76, 82contains operator 73context root 17creatingaction pages 107CFCs 64cross-field edits 108currency

Pagina 59 - Lesson 3: Retrieving Data

Index 151Ggreater than operator 73HHTML forms 73Iinserting, values in forms 139invoking methods 65, 68IsDefined function 85JJ2EE configuration

Pagina 60

152 IndexSQLAND operator 75commands 34data source 36described 34, 37dynamic 75, 124INSERT statement 131ORDER BY statement 36security risks 9

Pagina 61

16 Chapter 2: CFML BasicsThe best choice for creating ColdFusion pages is Macromedia Dreamweaver MX. Dreamweaver MX includes many CFML features for b

Pagina 62

Working with ColdFusion pages 17Saving your ColdFusion pageIn order for the ColdFusion server to process the page, you must save the ColdFusion page o

Pagina 63

18 Chapter 2: CFML BasicsThe following figure shows the cfpage.cfm page in the browser:2.Do the following tasks:aView the source code that was return

Pagina 64

About CFML elements 19Most often the end tag encloses the tag name in brackets and includes a forward slash (/), like this:</tagname>The informa

Pagina 65

Trademarks1 Step RoboPDF, ActiveEdit, ActiveTest, Authorware, Blue Sky Software, Blue Sky, Breeze, Breezo, Captivate, Central, ColdFusion, Contribute,

Pagina 66

20 Chapter 2: CFML BasicsFunctions and number signsYou use number signs (#) with functions to display the results of a function on the page. Number s

Pagina 67

About CFML elements 21Using functions on valuesUsually, a function performs an operation on a value, and the value can include the value of a variable

Pagina 68

22 Chapter 2: CFML BasicsIn the following examples, the variables are assigned a string literal value. All string literal values are surrounded by do

Pagina 69 - Summary 69

Working with CFML expressions 23Displaying variable outputOutput is what remains after the ColdFusion server processes the CFML tags on a page. Usuall

Pagina 70

24 Chapter 2: CFML BasicsBuilding expressionsIn ColdFusion, you build expressions as you need them. The expressions can include simple elements, such

Pagina 71 - CHAPTER 7

Working with CFML expressions 25For more information and examples on using number signs in expressions, see ColdFusion MX Developer’s Guide.Specifying

Pagina 72

26 Chapter 2: CFML BasicsThe following table lists the unsupported logical operators and their equivalent ColdFusion operators:Arithmetic operatorsTh

Pagina 73 - • Price greater than 1500

About conditional processing 27String operatorThe following table describes the one ColdFusion string operator that is a concatenation operator:About

Pagina 74

28 Chapter 2: CFML BasicsUsing the cfelseif tag to evaluate multiple expressionsTo evaluate multiple expressions in a cfif statement, you can use cfe

Pagina 75

Processing form data 29When a user submits a form, the form values are stored in form variables and sent to the action page for processing. The follow

Pagina 76 - ■ The SQL keyword AND

3CONTENTSINTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7PART I: Welcome to Cold

Pagina 77

30 Chapter 2: CFML BasicsCommenting your codeAs in other programming languages, it is important to include comments in your code. You should comment

Pagina 78

31CHAPTER 3Database Fundamentals This chapter provides a quick overview of relational database concepts and terms. It describes what a database is and

Pagina 79

32 Chapter 3: Database FundamentalsWhat is a relational database?A relational database is a structured collection of information that is related to a

Pagina 80

About database basics 33About relational tablesIn a database, you can organize data in multiple tables. For example, if you manage a database for the

Pagina 81

34 Chapter 3: Database FundamentalsAbout SQLSQL (Structured Query Language) is a language that lets you communicate with databases. For example, you

Pagina 82 - Search form

About SQL 35Using the SQL WHERE clause to limit the rows returnedTo conditionally select data from a table, you can add a WHERE clause to the SELECT s

Pagina 83 - Summary 83

36 Chapter 3: Database FundamentalsThe result of the preceding SQL statement contains the following data:Note: The preceding SQL SELECT examples use

Pagina 84

Using SQL with ColdFusion 37Writing SQL and CFML statements to interact with a data sourceAfter ColdFusion makes a connection to the data source, you

Pagina 85 - CHAPTER 8

38 Chapter 3: Database Fundamentals

Pagina 86

PART IIBuilding a ColdFusion ApplicationPart II provides a tutorial that steps you through building a sample Macromedia ColdFusion application. It con

Pagina 87

4 ContentsCHAPTER 5: Lesson 2: Configuring Your Development Environment. . . . . . . . . 49Exercise 1: Verifying the tutorial file structure . . . .

Pagina 89

41CHAPTER 4Lesson 1: Preparing to Build the Sample ApplicationThis tutorial guides you through the process of building a simple Macromedia ColdFusion

Pagina 90

42 Chapter 4: Lesson 1: Preparing to Build the Sample ApplicationThe following sections explore an overview of each of these application development

Pagina 91

Exercise 3: Designing the database for your application 43Exercise 2: Determining the data requirementsPrior to creating the application pages to capt

Pagina 92 - Detail page

44 Chapter 4: Lesson 1: Preparing to Build the Sample ApplicationIf you had to create the Compass Travel database, you would create a table named tri

Pagina 93 - Trip Detail pages

Exercise 3: Designing the database for your application 45Establishing a relationship between the two tablesWhen the user selects an event type from t

Pagina 94

46 Chapter 4: Lesson 1: Preparing to Build the Sample ApplicationExercise 4: Developing the sample applicationUsing the application functional requir

Pagina 95 - Summary 95

Exercise 4: Developing the sample application 47• Implement browsing and searching (“Lesson 8: Implementing Browsing and Searching” on page 123).• Ena

Pagina 96

48 Chapter 4: Lesson 1: Preparing to Build the Sample ApplicationYou can view ColdFusion application pages on your local computer by opening a web br

Pagina 97 - CHAPTER 9

49CHAPTER 5Lesson 2: Configuring Your Development EnvironmentIn this lesson, you set up your development environment for the tutorial. This lesson des

Pagina 98

Contents 5CHAPTER 11: Lesson 8: Implementing Browsing and Searching . . . . . . . . . . . . 123Exercise 1: Enabling users to browse trip details . .

Pagina 99

50 Chapter 5: Lesson 2: Configuring Your Development EnvironmentNote: When you use the J2EE configuration, the cfdocs directory is under the ColdFusi

Pagina 100 - Reviewing the code

Exercise 2: Setting up your development environment 51With Dreamweaver MX, you can author and test your application code from a local or remote client

Pagina 101 - Summary 101

52 Chapter 5: Lesson 2: Configuring Your Development EnvironmentExercise 3: Configuring a database connectionOne of the most commonly used and most p

Pagina 102

Exercise 3: Configuring a database connection 53To access the ColdFusion MX 7 Administrator:• Open a browser and go to one of the following URLs: Ext

Pagina 103 - Business Rules

54 Chapter 5: Lesson 2: Configuring Your Development EnvironmentTo define the sample PointBase database file: 1.In the ColdFusion MX Administrator, s

Pagina 104

Exercise 4: Configuring debugging options 557.Click Verify All Connections to ensure that ColdFusion can access this file. OK appears in the Status co

Pagina 105

56 Chapter 5: Lesson 2: Configuring Your Development EnvironmentThe location of the debugging information or the type of debugging data shown varies,

Pagina 106

Summary 57Sending debugging information to remote clientsIf you are using a remote client to perform the tutorial in this book, you must specify your

Pagina 107

58 Chapter 5: Lesson 2: Configuring Your Development Environment

Pagina 108

59CHAPTER 6Lesson 3: Retrieving Data In this lesson, you begin the construction of a Macromedia ColdFusion web application for the fictitious company,

Pagina 109

6 Contents

Pagina 110

60 Chapter 6: Lesson 3: Retrieving DataExercise 1: About the trip listAs you recall from “Lesson 1: Preparing to Build the Sample Application” on pag

Pagina 111

Exercise 2: Retrieving the information for the trip list 61Exercise 2: Retrieving the information for the trip listRelational database management syst

Pagina 112

62 Chapter 6: Lesson 3: Retrieving DataReviewing the codeThe following table describes the code used to build the query:Exercise 3: Displaying the qu

Pagina 113

Exercise 4: Writing structured, reusable code 63<body><h1>Trip List</h1><cfoutput query="TripList">#tripName#<br&

Pagina 114 - To test the validation code:

64 Chapter 6: Lesson 3: Retrieving DataTo create the CFC file:1.Create a directory named components as a subdirectory of the my_app directory.2.Open

Pagina 115

Exercise 4: Writing structured, reusable code 65Copying the query to the CFCTo copy the query to the CFC, you copy the CFML to the CFC, between the op

Pagina 116

66 Chapter 6: Lesson 3: Retrieving DataLet Dreamweaver do itDreamweaver lets you invoke a method in a CFC without having to write the code.To invoke

Pagina 117

Exercise 5: Creating additional queries 67output="false"><cfquery name="budgetTrips" datasource="CompassTravel">

Pagina 118

68 Chapter 6: Lesson 3: Retrieving DataInvoking the new methodTo use the new query, you invoke the method that contains the query.To invoke the new m

Pagina 119

Summary 693.Save both the triplisting.cfm file and the gettrips.cfc file.4.View the triplisting.cfm page in a browser and verify that all the new requ

Pagina 120

7INTRODUCTIONGetting Started Building ColdFusion MX Applications is intended for anyone who needs to begin programming in the Macromedia ColdFusion MX

Pagina 121 - ■ For MS Windows systems:

70 Chapter 6: Lesson 3: Retrieving Data

Pagina 122

71CHAPTER 7Lesson 4: Building Dynamic Queries In this lesson, you develop a search form to allow users to select the information to retrieve, and then

Pagina 123 - CHAPTER 11

72 Chapter 7: Lesson 4: Building Dynamic QueriesA better solution is to provide an interface for the user to specify the search criteria. The purpose

Pagina 124

Exercise 1: Creating the trip search form 73In later exercises, you will reference these columns when you build the SQL SELECT statement for the cfque

Pagina 125

74 Chapter 7: Lesson 4: Building Dynamic Queries<title>Trip Maintenance - Search Form</title></head><body><img src="i

Pagina 126

Exercise 2: Building a query that uses dynamic SQL 75</form></body></html>3.Save the file as tripsearchform.cfm in the my_app direct

Pagina 127

76 Chapter 7: Lesson 4: Building Dynamic QueriesThe action page invokes a method that builds the WHERE clause so that the SQL SELECT statement retrie

Pagina 128

Exercise 2: Building a query that uses dynamic SQL 77<cfset WhereClause = WhereClause & " AND tripLocation like '" &form.tri

Pagina 129 - CHAPTER 12

78 Chapter 7: Lesson 4: Building Dynamic Queries</cfquery><cfreturn TripResult></cffunction>4.Add the highlighted code to the cfque

Pagina 130

Exercise 3: Constructing the initial Trip Search Results page 79Exercise 3: Constructing the initial Trip Search Results pageAfter the user enters the

Pagina 131 - VALUES (value1, value2,...)

8 Introduction: Viewing online documentationAll ColdFusion MX documentation is available online in HTML and Adobe Acrobat Portable Document Format (P

Pagina 132

80 Chapter 7: Lesson 4: Building Dynamic Queries</td></tr><cfoutput query="TripResult"><tr> <td>#tripName#&l

Pagina 133 - Save the file

Exercise 4: Testing the Trip Search Results page 81The preceding code only builds the tripLocation subclause. In the following exercise, you will add

Pagina 134

82 Chapter 7: Lesson 4: Building Dynamic Queries3.Verify that the other criteria (departure date and price) are not taken into consideration yet as f

Pagina 135

Summary 834.To build the price WHERE subclause, enter the following code after the code you entered in the previous step.<!--- Build subclause for

Pagina 136

84 Chapter 7: Lesson 4: Building Dynamic Queries

Pagina 137

85CHAPTER 8Lesson 5: Creating a Trip Detail PageIn this lesson you will enhance the Compass Travel Trip Maintenance application. This lesson contains

Pagina 138

86 Chapter 8: Lesson 5: Creating a Trip Detail PageExercise 1: Creating a Trip Detail pageBy design, the Trip Search Results page displays a subset o

Pagina 139

Exercise 1: Creating a Trip Detail page 87To build the CFC query:1.Create a blank ColdFusion page.2.Save the file as tripdetail.cfm in the my_app dire

Pagina 140

88 Chapter 8: Lesson 5: Creating a Trip Detail Page12.In the Component Location text box, enter /components/.13.In the Recordset name text box, enter

Pagina 141

Exercise 1: Creating a Trip Detail page 89<tr><td valign="top">Return Date:</td><td>#returnDate#</td></tr&g

Pagina 142

PART IWelcome to ColdFusionPart I provides an introduction to Macromedia ColdFusion MX 7. It defines ColdFusion MX 7 and provides an overview of the C

Pagina 143 - ColdFusion Applications

90 Chapter 8: Lesson 5: Creating a Trip Detail Page4.Add the following code at the end of the file:</body></html>5.Save the file.To view

Pagina 144 - <cfinclude

Exercise 2: Avoiding the potential security risk when using dynamic SQL 91Reviewing the codeThe following table describes the ColdFusion code that you

Pagina 145 - Access must be RDS

92 Chapter 8: Lesson 5: Creating a Trip Detail PageIf a user called the Trip Detail page using the following statement:http://localhost/cfdocs/gettin

Pagina 146

Exercise 4: Enhancing the look of the Trip Search Results and Trip Detail pages 93To test the revised page:1.View the tripsearchform.cfm page from the

Pagina 147

94 Chapter 8: Lesson 5: Creating a Trip Detail Page2.Save the file.3.To format the currency and date fields on the Trips Search Results page, open th

Pagina 148 - To test the authentication:

Summary 95SummaryIn this lesson, you transformed the search facility that you built in “Lesson 4: Building Dynamic Queries” into a drill-down facility

Pagina 149

96 Chapter 8: Lesson 5: Creating a Trip Detail Page

Pagina 150 - 150 Index

97CHAPTER 9Lesson 6: Creating a Main Application PageIn this lesson you will enhance the Compass Travel Trip Maintenance application. So far, you crea

Pagina 151 - Index 151

98 Chapter 9: Lesson 6: Creating a Main Application PageExercise 1: Creating the main application page from the Trip Detail pageIn this exercise, you

Pagina 152 - 152 Index

Exercise 1: Creating the main application page from the Trip Detail page 99To add navigation buttons to the Trip Detail page:1.Open the tripdetail.cfm

Comentarios a estos manuales

Sin comentarios