Adobe COLDFUSION 9 Manual page 128

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
The CFML Programming Language
For example:
public function funcname(required string argument1)
Interface definitions follow the same pattern as components, with the same general rules and limitations that apply to
the interfaces you define using cfinterface tags. The following simple code defines an interface with a single function
that takes one string argument, with a default argument value of "Hello World!":
interface {
function method1(string arg1="Hello World!");
function method2 (string arg1="Goodbye World!");
...
}
The following example shows the definition of a simple component with a single function:
/**
* Component defined in CFScript
* @output true
*/
component extends="component_01" {
/**
* Function that displays its arguments and returns a string.
* @returnType string
*/
public function method_03(argOne,argTwo) {
WriteOutput("#arguments.argOne# ");
WriteOutput("#arguments.argTwo# ");
return("Arguments written.");
}
}
Setting attributes
The definition syntax provides two ways to set attributes:
• At the end of a comment that immediately precedes the element, in the following format
/**
*Comment
*@attributeName1 attributeValue
*@attributeName2 attributeValue
*...
*/
• In the element declaration using standard attribute-value assignment notation, as in the following line:
component extends="component_01"
Attribute values set in the element declaration take precedence over the values set in the comment section. Therefore,
if you set an attribute, such as a hint in both locations, ColdFusion ignores the value in the comment section and uses
only the one in the element declaration.
Specifying page encoding
You can specify the character encoding of a component by specifying a
of the component body. You can specify the
shows how to use the directive:
pageencoding
directive only for components. The following code snippet
pageencoding
Last updated 8/5/2010
processing directive at the top
123

Advertisement

Table of Contents
loading

Table of Contents