![MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual Download Page 353](http://html1.mh-extra.com/html/macromedia/coldfusion-4-5-developing-web/coldfusion-4-5-developing-web_develop-manual_3286369353.webp)
Chapter 19: Using CFOBJECT to Invoke Component Objects
327
Invoking Component Objects
The CFOBJECT tag is used to create an instance of the object and other ColdFusion
tags, such as CFSET and CFOUTPUT, are used to invoke properties (attributes), and
methods (operations) on the object. An object created by CFOBJECT or returned by
other objects is implicitly released at the end of the template execution.
Coding guidelines
The following coding practice is required (or recommended) when accessing the
object. Assume that the NAME attribute in the CFOBJECT tag specified the value "obj",
and that the object has a property called "Property", and methods called "Method1",
"Method2", and "Method3".
To set a property:
<CFSET obj.property = "somevalue">
To get a property:
<CFSET value = obj.property>
Note that parentheses are not used on the right side of the equation for property-gets.
Calling methods
Object methods usually take zero or more arguments. Arguments can be sent by value
([in] arguments) or by reference ([out] and [in,out]). Arguments sent by reference
usually have their value changed by the object. Some methods return values while
others may not.
Methods with no arguments:
<CFSET retVal = obj.Method1()>
Note that parentheses are required for methods with no arguments.
Methods with one or more arguments:
<CFSET x = 23>
<CFSET retVal = obj.Method1(x, "a string literal")>
This method accepts one integer argument, and one string argument.
Methods with reference arguments:
<CFSET x = 23>
<CFSET retVal = obj.Method2("x", "a string literal")>
<CFOUTPUT> #x#</CFOUTPUT>
Note the use of double-quotes ("") to specify reference arguments. If the object
changes the value of "x", it will now contain a value other than 23.
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...