
24
DEVELOPING
COLDFUSION 9 APPLICATIONS
The CFML Programming Language
Las
t
upda
te
d 8/5/2010
3
Execute one or more actions on the object.
Note:
Unlike the corresponding tags, you cannot use application-specific parameters in these functions. You can only use
the parameters that ColdFusion supports directly.
Step 1: Instantiate a service object
To create a function object, such as a mail object, use the
new
operator or
createobject()
function, as in the
following example:
myMail = new mail(server="sendmail.myCo.com");
Step 2a: Managing attributes
You can set attributes in several ways:
•
As name=value parameters to the object initializer when you instantiate the object, as in the following example.
myMail = new mail(server="sendmail.myCo.com");
•
As name=value parameters to an object action method, as in the following example:
Q = myQuery.execute(sql="select * from art");
•
By using attribute setters, as in the following example:
myMail.setSubject("Hi");
Note:
You cannot use a
getAttributeName
function to get the value of the attribute specified by AttributeName.
Instead, use
GetAttributes(AttributeName)
.
•
By using the following functions:
SetAttributes(attrib1=value,attrib2=value,...);
GetAttributes([attribName1[,attribName2]]....);
ClearAttributes([attribName1[,attribName2]]...);
Note:
If you specify a result attribute for a stored procedure, then calling
getPrefix()
returns,
executionTime,statusCode,cached
. If you do not specify a result attribute,
getPrefix()
returns only
executionTime
and
statusCode
.
Step 2b: Managing child tag operations
All service objects correspond to tags that have child tags. For example,
cfmail
has
cfmailpart
and
cfmailparam
child tags.
To specify the child tag functionality, use the following methods:
•
httpObj.addParam
•
mailObj.addParam
•
mailObj.addPart
•
pdfObj.addParam
•
queryObj.addParam
•
storedProcObj.addParam
•
storedProcObj.addProcResult
For example:
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...