
25
DEVELOPING
COLDFUSION 9 APPLICATIONS
The CFML Programming Language
Las
t
upda
te
d 8/5/2010
mailObj.addparam(file="#ExpandPath('test.txt')#");
mailObj.addPart(name="foo",type="html",charset="utf-8",
body="This is a test message.");
You can also clear child tag settings by calling the following functions.
•
httpObj.clearParams
•
mailObj.clearParams
•
mailObj.clearParts
•
pdfObj.clearParams
•
queryObj.clearParams
•
storedProcObj.clearParams
•
storedProcObj.clearProcResults
If you used multiple add methods on an object, the clear method clears all values set in all the methods.
Step 3: Executing service actions
Service tags, excluding cfmail and cfpdf, have one or more actions that return results. Some, including the cfpdf and
cfftp tags have action attributes. For these tags, each action corresponds to a method on the service object. For example,
the ftp object action methods include
open
,
close
,
listDir
,
getFile
,
rename
, and many others. However, the way
service tags return data has changed. Now, a component is returned with applicable properties set and you need to
invoke getters on the properties to access the data.
Note:
The PDF object has two action methods whose names differ from the corresponding cfftp action attribute values:
getPDFInfo
and
setPDFInfo
instead of
getInfo
and
setInfo
. This difference is required to prevent name collisions
with the set and get methods for the PDF info attribute.
The
cfhttp
,
cfmail
,
cfquery
, and
cfstoredproc
tags do not have action attributes. Instead, the tags perform a
single action. To perform these actions in
cfscript
, call the following functions:
•
httpObj.send()
•
mailObj.send()
•
queryObj.execute()
•
storedProcObj.execute()
To get an action result, you typically assign the results of the action method to a variable, as in the following example:
Q = qry.execute(sql="select * from art");
Note:
The attributes that specify you for an action are valid only for that action and are cleared once the action is
completed.
Service code example: mail, ftp, and http
The following example shows the use of the mail, http, and ftp services in
cfscript
.
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...