MACROMEDIA COLDFUSION 5 - INSTALING AND CONFIGURING SERVER Manuel d'instructions

Naviguer en ligne ou télécharger Manuel d'instructions pour Serveurs MACROMEDIA COLDFUSION 5 - INSTALING AND CONFIGURING SERVER. MACROMEDIA COLDFUSION 5 - INSTALING AND CONFIGURING SERVER Programming instructions Manuel d'utilisatio

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 154
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs

Résumé du contenu

Page 1

Getting Started Building ColdFusion MX Applications

Page 2

x About This BookViewing online documentationAll ColdFusion documentation is available online in HTML and Adobe Acrobat Portable Document Format (

Page 3 - CONTENTS

90 Lesson 3 Creating a Main Application Page3 In the Trip Location drop-down list box, select Begins With and type the value C in the trip location

Page 4

Enhancing the Trip Maintenance application 91The following example uses the MOD function to alternate the background color of table rows:<cfoutput

Page 5

92 Lesson 3 Creating a Main Application Page2 To format the currency and date fields on the Trips Search Results page, open the tripsearchresult.cf

Page 6

Enhancing the Trip Maintenance application 935 In the Trip Search Result page, click the link for Riding the Rockies. The properly formatted Trip Deta

Page 7 - ABOUT THIS BOOK

94 Lesson 3 Creating a Main Application PageAdding navigation buttons to browse databaseThe drill-down search function developed in the last exerci

Page 8 - Developer resources

Enhancing the Trip Maintenance application 953 Save the file and view the updated tripdetail.cfm page in a browser.The Trip Search Results page appear

Page 9

96 Lesson 3 Creating a Main Application PageAdding database maintenance buttonsThe search and sequential navigation capabilities are features for l

Page 10 - Contacting Macromedia

Enhancing the Trip Maintenance application 973 Save the file and view the updated tripdetail.cfm page in a browser (http://localhost/CFDOCS/getting_st

Page 11 - Welcome to ColdFusion

98 Lesson 3 Creating a Main Application PageSummaryIn this lesson, you transformed the search facility you built in Lesson 2 into a drill-down faci

Page 12

99LESSON 4Validating Data to Enforce BusinessRulesIn this lesson, you will enhance the Compass Travel Trip Maintenance application. The exercises in t

Page 13 - Introducing ColdFusion MX

PART IWelcome to ColdFusionPart I provides an introduction to ColdFusion. It defines ColdFusion and provides an overview of the ColdFusion Markup Lang

Page 14 - The Internet

100 Lesson 4 Validating Data to Enforce Business RulesEnhancing the Trip Maintenance applicationIn this lesson and the next, you will create the co

Page 15 - Web pages

Using an HTML form to collect data 101Using an HTML form to collect dataBased on the data requirements determined in Lesson 1, the following figure sh

Page 16 - Web browsers

102 Lesson 4 Validating Data to Enforce Business Rules3 Save the file as tripedit.cfm to the my_app directory.4 View the tripedit.cfm in a browser

Page 17

Developing code to validate data and enforce business rules 103Developing code to validate data and enforce business rulesAs described in Lesson 1, it

Page 18 - What is ColdFusion MX?

104 Lesson 4 Validating Data to Enforce Business RulesValidating data using a server-side action pageThe first approach you will take to enforce Co

Page 19 - • Tags that begin with cf

Developing code to validate data and enforce business rules 105The cfset tag lets you manipulate the value of a variable. For example, the following p

Page 20 - • Application security

106 Lesson 4 Validating Data to Enforce Business Rules<!--- Price must be 20% greater than Base Cost ---><cfif Form.baseCost * 1.2 GT #Fo

Page 21

Developing code to validate data and enforce business rules 107the network and the server. If the data is validated on the client, then only valid dat

Page 22

108 Lesson 4 Validating Data to Enforce Business RulesClient-side validation approach using ColdFusion form tagThe following code is on the client:

Page 23 - CFML Basics

Developing code to validate data and enforce business rules 109Tip: For additional help, review the completed code in the tripedit2.cfm within the sol

Page 25

110 Lesson 4 Validating Data to Enforce Business Rules</body></html>7 View the tripedit.cfm page in a browser and test the client- and

Page 26 - Understanding CFML elements

Developing code to validate data and enforce business rules 111<!--- Field: eventType ---><tr><td valign="top">Type of Eve

Page 27 - Functions

112 Lesson 4 Validating Data to Enforce Business RulesUsing other client-side script to reduce edits on the serverIf you were interested in moving

Page 28 - Functions and pound signs

Developing code to validate data and enforce business rules 113var testdate = new Date(dateString.substring(6,10),dateString.substring(0,2)-1,dateStri

Page 29 - Variables

114 Lesson 4 Validating Data to Enforce Business RulesThe important point about the preceding JavaScript is that you can use two functions, isitFut

Page 30 - Displaying variable output

Developing code to validate data and enforce business rules 115Validating the existence of the trip photo file At this point, you have a more efficien

Page 31 - Working with CFML expressions

116 Lesson 4 Validating Data to Enforce Business RulesReviewing the codeThe following table describes the code used to verify whether a file exists

Page 32

Summary 1173 Save the page and test it by opening the tripedit.cfm page in your browser.Testing recommendations:a In the Trip Edit page entering valid

Page 33

118 Lesson 4 Validating Data to Enforce Business Rules

Page 34 - String operator

119LESSON 5Implementing the Browsing andMaintenance Database FunctionsIn this lesson, you will enhance the Compass Travel ColdFusion application by pr

Page 35

3CHAPTER 1Introducing ColdFusion MXThis chapter introduces the core technologies that are the foundation for Macromedia ColdFusion MX. It provides a b

Page 36 - Processing form data

120 Lesson 5 Implementing the Browsing and Maintenance Database FunctionsEnhancing the Trip Maintenance applicationIn this lesson, you will make en

Page 37

Enhancing the Trip Maintenance application 121Maintenance action pageThe maintenance action page processes a user’s maintenance request from the Trip

Page 38 - Commenting your code

122 Lesson 5 Implementing the Browsing and Maintenance Database FunctionsFor example, if the current tripID equals 6, the following table identifie

Page 39 - Database Fundamentals

Enhancing the Trip Maintenance application 123<cfelseif IsDefined("Form.btnLast.X")>ORDER BY tripID DESC</cfif></cfquery>&

Page 40 - Understanding database basics

124 Lesson 5 Implementing the Browsing and Maintenance Database FunctionsExercise: implement trip record browsing (navigation)Follow these steps to

Page 41

Enhancing the Trip Maintenance application 125<cfelseif IsDefined("Form.btnEdit")>...<cfelseif IsDefined("Form.btnAdd")&g

Page 42 - About SQL

126 Lesson 5 Implementing the Browsing and Maintenance Database FunctionsDELETE FROM trips WHERE tripID = #Form.RecordID#Exercise: handle search an

Page 43 - Using SQL with ColdFusion

Enhancing the Trip Maintenance application 1277In the Trip Search page, select begins with in the selection box for Trip Location. Then enter Imji in

Page 44

128 Lesson 5 Implementing the Browsing and Maintenance Database FunctionsSummaryIn this lesson, you converted the Trip Detail page from the search

Page 45 - Environment

129LESSON 6Adding and Updating SQL DataIn this lesson, you will complete the Compass Travel Trip Maintenance application. The exercises will guide you

Page 46

4 Chapter 1 Introducing ColdFusion MXThe Internet and related technologiesColdFusion MX is tightly integrated with the Internet and the World Wide

Page 47

130 Lesson 6 Adding and Updating SQL DataCompleting the Trip Maintenance applicationIn Lesson 5, you created the tripeditaction.cfm page to contain

Page 48

Completing the Trip Maintenance application 131After the following SQL statement executes:INSERT INTO ClientsVALUES ('Smith', 'Kaleigh&

Page 49

132 Lesson 6 Adding and Updating SQL DataTip: To save time, you can copy this code from the tripsinsertquery.txt file (for Windows users) or from t

Page 50 - Enabling debugging options

Completing the Trip Maintenance application 1334 In the tripedit.cfm page, fill in the fields with the values in the following figure, then click Save

Page 51 - To enable debugging options:

134 Lesson 6 Adding and Updating SQL Data7 Click Search. The TripResults page appears:8 Click the link to the NH White Mountains to display the det

Page 52

Completing the Trip Maintenance application 135Reviewing the codeThe following table describes the SQL INSERT and cfquery code used to add data:For mo

Page 53 - MX window

136 Lesson 6 Adding and Updating SQL DataThe cfinsert tag used in the previous code snippet uses the following attributes:Exercise: insert trip dat

Page 54

Completing the Trip Maintenance application 137<cfupdate datasource="CompassTravel" tablename="Trips"><cflocation url=&qu

Page 55

138 Lesson 6 Adding and Updating SQL DataFor more information about adding data to a database using the cfupdate tag, see Developing ColdFusion MX

Page 56

Completing the Trip Maintenance application 139<cfset eventTypeIdentifier = #TripQuery.eventType#><cfset tripLocation = ''><c

Page 57 - Application

The Internet and related technologies 5Intranet applicationsAn intranet is a private LAN (Local Area Network) or WAN (Wide Area Network) that lets you

Page 58

140 Lesson 6 Adding and Updating SQL Data3 Insert the following code just before the last line:<!--- EDIT BUTTON ---><cfelseif IsDefined(&

Page 59 - Preparing to Build the Sample

Completing the Trip Maintenance application 141After the following SQL statement executes:UPDATE Clients SET LastName = ’Pitt’WHERE ID = 3the table co

Page 60

142 Lesson 6 Adding and Updating SQL Data3 Add the following code:<!---Routine to increase trip price by 10% ---><cfquery name="TripQ

Page 61

143INDEXAaction page, defined 26application. See tutorialCcfform, defined 99cfif, defined 59cfinput, defined 99cfinsert, defined 129cflocation, define

Page 62

144 Indexsyntax 18URLEncodedFormat 81HHTML, defined 6IInternetapplications 4defined 4intranetapplication 5defined 5IsDefined function, defined 81JJava

Page 63 - Recognizing the data types

6 Chapter 1 Introducing ColdFusion MXWeb browsersA web browser is a software program residing on a computer that you use to view pages on and navig

Page 64

The Internet and related technologies 7URLsEvery piece of information on the World Wide Web has a unique address. This address is called a Uniform Res

Page 65 - How to proceed

8 Chapter 1 Introducing ColdFusion MXWeb application servers process code in a page that a browser and web server cannot interpret. The web server

Page 66

What is ColdFusion MX? 9The ColdFusion application serverThe ColdFusion application server is a software program that resides on the same computer as

Page 67

TrademarksAfterburner, AppletAce, Attain, Attain Enterprise Learning System, Attain Essentials, Attain Objects for Dreamweaver, Authorware, Authorware

Page 68

10 Chapter 1 Introducing ColdFusion MXDevelopment toolsWhile you can code your ColdFusion application with NotePad or any HTML editor, Macromedia r

Page 69 - Writing Your First ColdFusion

Using ColdFusion MX with Macromedia Flash MX 11Using ColdFusion MX with Macromedia Flash MXMacromedia Flash MX is designed to overcome the many limita

Page 70

12 Chapter 1 Introducing ColdFusion MX

Page 71

13CHAPTER 2CFML BasicsThis chapter introduces the basic elements of CFML, including how to create ColdFusion pages, and use variables, functions, cond

Page 72

14 Chapter 2 CFML BasicsWorking with ColdFusion pagesAs discussed in Chapter 1, ColdFusion pages are plain text files that you use to create web ap

Page 73

Working with ColdFusion pages 15To create a ColdFusion page:1 Open your editor and create a blank file.2 Enter the following code on the page:<html

Page 74 - Sorting the results

16 Chapter 2 CFML BasicsThe following figure shows the cfpage.cfm in the browser:2 Do the following tasks:a View the source code that was returned

Page 75

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

Page 76 - Creating a dynamic web page

18 Chapter 2 CFML BasicsThe DollarFormat function returns a value as a string and formats that value with two decimal places, thousand separator, a

Page 77

Understanding CFML elements 19If you did not include the pound signs around the DateFormat(Now(), "mm/ddyyy") function, the output for the p

Page 78

iiiCONTENTSABOUT THIS BOOK . . . . . . . . . . . . . . . . . . . . . . . . . . . VIIDeveloper resources . . . . . . . . . . . . . . . . . . . . . . .

Page 79

20 Chapter 2 CFML BasicsIn the next example, ColdFusion uses the values of the my_first_name and my_last_name variables to set the value for the my

Page 80 - • price greater than 1500

Working with CFML expressions 21One of the tags that ColdFusion provides to display output is the cfoutput tag. The cfoutput tag instructs ColdFusion

Page 81

22 Chapter 2 CFML BasicsAs mentioned, it is important that elements are identified properly in your expression so ColdFusion processes them as expe

Page 82

Working with CFML expressions 23Specifying quotation marks around valuesWhen assigning literal values to variables, you must surround the literal valu

Page 83

24 Chapter 2 CFML BasicsArithmetic operatorsThe following table lists the arithmetic operators that ColdFusion supports:String operatorThe followin

Page 84

Understanding conditional processing 25Understanding conditional processing To this point, all the coding examples shown are considered linear coding

Page 85

26 Chapter 2 CFML BasicsUsing cfelseif to evaluate multiple expressionsTo evaluate multiple expressions in a cfif statement, you can use cfelseif a

Page 86

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

Page 87

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

Page 88 - 3 To build the

29CHAPTER 3Database FundamentalsThis chapter provides a quick overview of relational database concepts and terms. It describes what a database is and

Page 89

iv Contents Processing form data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26Form

Page 90

30 Chapter 3 Database FundamentalsUnderstanding database basicsEven though you do not need a thorough understanding of database management systems

Page 91 - LESSON 3

Understanding database basics 31Understanding relational tablesIn a database, you can organize data in multiple tables. For example, if you manage a d

Page 92

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

Page 93

Using SQL with ColdFusion 33Using SQL with ColdFusionColdFusion communicates with your data source through a database interface called JDBC. JDBC is a

Page 94

34 Chapter 3 Database Fundamentals

Page 95

35CHAPTER 4Configuring Your DevelopmentEnvironmentThis chapter describes how to set up your development environment for the tutorial in Part II of thi

Page 96

36 Chapter 4 Configuring Your Development EnvironmentVerifying the tutorial file structureBefore you being the tutorial, verify that the configurat

Page 97

Configuring database connection and debugging options 37The photos directory contains the required photo files for the tutorial application. The solut

Page 98

38 Chapter 4 Configuring Your Development Environment4 Specify the following:5 Click Show Advanced Settings and ensure that the settings for CLOB a

Page 99

Configuring database connection and debugging options 393 Click Add to configure the data source name and driver. The PointBase data source dialog box

Page 100

C o n t e n t s vLESSON 3 Creating a Main Application Page . . . . . . . . . . . . . . . . 81Enhancing the Trip Maintenance application. . . . .

Page 101

40 Chapter 4 Configuring Your Development Environment7 Click Verify All Connections to ensure that ColdFusion can access this file. OK appears in t

Page 102

Configuring database connection and debugging options 41The location of the debugging information or the type of debugging data shown varies, dependin

Page 103

42 Chapter 4 Configuring Your Development EnvironmentFor the purpose of the tutorial in Part II of this book, enable the following debugging option

Page 104

Macromedia development environment tools 43Macromedia development environment toolsMacromedia Dreamweaver MX is the preferred development environment

Page 105 - Reviewing the code

44 Chapter 4 Configuring Your Development EnvironmentThe Dreamweaver MX environmentAs a ColdFusion developer, you can build ColdFusion MX applicati

Page 106

Macromedia development environment tools 45Configuring Dreamweaver MX for ColdFusion developmentBefore you use Dreamweaver MX to create the sample app

Page 107

46 Chapter 4 Configuring Your Development Environment

Page 108 - In the next lesson

PART IIBuilding a ColdFusionApplicationPart II provides a tutorial that steps you through building a sample ColdFusion application. It consists of six

Page 110

49LESSON 1Preparing to Build the SampleApplicationIn this tutorial, you will build a simple ColdFusion web application for a fictitious travel company

Page 111

vi Contents

Page 112

50 Lesson 1 Preparing to Build the Sample ApplicationApplication development stepsMost software applications perform three major functions:• A user

Page 113

Determining the application functional requirements 51Determining the application functional requirementsBefore you can build the sample application,

Page 114 - in a cfif

52 Lesson 1 Preparing to Build the Sample ApplicationDetermining the data requirementsPrior to creating the application pages to capture trip infor

Page 115

Designing the database for your application 53Designing the database for your applicationAfter you identify the information to collect, you must consi

Page 116

54 Lesson 1 Preparing to Build the Sample ApplicationEstablishing a relationship between the two tablesWhen the user selects an event type from the

Page 117

Developing the sample application 55Developing the sample applicationGiven the application functional requirements and the database provided, you are

Page 118

56 Lesson 1 Preparing to Build the Sample ApplicationEach lesson guides you through a scenario to enhance the Compass Travel Trip Maintenance appli

Page 119

Developing the sample application 57RequirementsTo use this tutorial, you must have the following components installed:• ColdFusion Server For informa

Page 120

58 Lesson 1 Preparing to Build the Sample Application

Page 121

59LESSON 2Writing Your First ColdFusionApplicationIn this lesson, you begin the construction of a ColdFusion web application for the fictitious compan

Page 122

viiABOUT THIS BOOKGetting Started Building ColdFusion MX Applications is intended for anyone who wants to learn how to use ColdFusion MX to create web

Page 123

60 Lesson 2 Writing Your First ColdFusion ApplicationCreating your first ColdFusion applicationAs you recall from Lesson 3, two of the requirements

Page 124

Creating your first ColdFusion application 61• Trip Search Results page The purpose of the Trip Search Results page is to display the results of a tri

Page 125

62 Lesson 2 Writing Your First ColdFusion ApplicationUsing a web page to list tripsTo help Compass Travel agents take trip reservations by telephon

Page 126 - • For MS Windows systems:

Using a web page to list trips 63Consider a table named Clients to hold information about people with the following rows:To select the columns named L

Page 127

64 Lesson 2 Writing Your First ColdFusion ApplicationFor example, to select the columns named Last Name and First Name for Clients whose City is Bo

Page 128

Using a web page to list trips 65the Trip List page presented earlier in this lesson. In this example, you use cfquery to return all the trip names fo

Page 129 - LESSON 5

66 Lesson 2 Writing Your First ColdFusion ApplicationCreating a dynamic web pageIn the following exercises you will build a dynamic Trip Listing we

Page 130 - Navigation action page

Using a web page to list trips 67Reviewing the codeThe following table describes the code used to build the query:Exercise: enhancing the queryIn this

Page 131 - Application development steps

68 Lesson 2 Writing Your First ColdFusion Application3 Create the Budget Trip List report by doing the following:a Modify the SQL SELECT statement,

Page 132

Developing a search capability 69Developing a search capabilityThe dynamic listings developed in the previous exercise meet many of Compass Travel’s r

Page 133

viii About This BookDeveloper resourcesMacromedia, Inc. is committed to setting the standard for customer support in developer education, document

Page 134 - maintenance action page:

70 Lesson 2 Writing Your First ColdFusion Application• price• tripIDIn later exercises, you will reference these columns when you build the SQL SEL

Page 135 - SQL DELETE Statement

Developing a search capability 71Using SQL operators to create a search criteria pageA simple design for a search criteria page presents an operator l

Page 136

72 Lesson 2 Writing Your First ColdFusion Application<td><select name="departureOperator"><option value="EQUALS"

Page 137

Developing a search capability 73Building the Search Results page Based on the queryable columns identified earlier, the SQL query to display the sear

Page 138

74 Lesson 2 Writing Your First ColdFusion ApplicationBuilding a SQL WHERE clause in code is largely an exercise in string concatenation. The &

Page 139 - Adding and Updating SQL Data

Developing a search capability 75<!--- Create Where clause for query from data entered thru search form ---><cfset WhereClause = " 0=0 &

Page 140

76 Lesson 2 Writing Your First ColdFusion ApplicationReviewing the codeThe following table describes the code used to build the tripLocation WHERE

Page 141

Developing a search capability 77The Trip Results page displays several entries as follows:c Notice in the Trip Results page that only one trip has a

Page 142

78 Lesson 2 Writing Your First ColdFusion Application2 To build the departureDate WHERE subclause, enter the code in the following table immediatel

Page 143

Developing a search capability 794 Verify that the price and departureDate are now considered in the query, as in step 4 in the previous exercise:a Op

Page 144

About Macromedia ColdFusion MX documentation ixAbout Macromedia ColdFusion MX documentationThe ColdFusion documentation is designed to provide support

Page 145

80 Lesson 2 Writing Your First ColdFusion ApplicationSummaryThis lesson described how to access a relational database using ColdFusion. You used th

Page 146

81LESSON 3Creating a Main Application PageIn this lesson you will enhance the Compass Travel Trip Maintenance application. The exercises in this lesso

Page 147

82 Lesson 3 Creating a Main Application PageEnhancing the Trip Maintenance applicationIn this lesson you will enhance the Trip Maintenance applicat

Page 148

Enhancing the Trip Maintenance application 83• Enhanced Trip Search Results page. The original purpose of the Trip Search Results page in Lesson 2 was

Page 149

84 Lesson 3 Creating a Main Application PageThe primary users of these components will be the Compass Travel coordinators and agents, not the gener

Page 150 - SQL Update

Enhancing the Trip Maintenance application 85Exercise: building a Trip Detail pageFollow these steps to build a Trip Detail page.To build a Trip Detai

Page 151 - Updating multiple records

86 Lesson 3 Creating a Main Application Page<td>#returnDate#</td></tr><tr><td valign="top">Price:</td>

Page 152

Enhancing the Trip Maintenance application 878 The Rio Cahabon Rafting trip has an tripID of 24. To view the trip detail for the trip in your browser

Page 153

88 Lesson 3 Creating a Main Application PageReviewing the codeThe following table describes the ColdFusion code used to build the Trip Detail page:

Page 154

Enhancing the Trip Maintenance application 89Protecting your applicationTo ensure that your application is protected from such an attack, you can expl

Commentaires sur ces manuels

Pas de commentaire