User Guide

cfproperty 281
Usage
You must position cfproperty tags at the beginning of a component, above executable code and
function definitions.
If a component is not used as a web service, The
cfproperty only provides metadata information
when the component is viewed using introspection, for example, by opening the .cfc file directly
in the browser. It does not define variables or set values that you can then use in your
compoenent.
For web services that you create in ColdFusion, the cfproperty tag defines complex variables used
by the web service.
Exceptions
The following code defines a component in the file address.cfc that contains properties that
represent a street address:
<cfcomponent>
<cfproperty name="Number" type="numeric">
<cfproperty name="Street" type="string">
<cfproperty name="City" type="string">
<cfproperty name="State" type="string">
<cfproperty name="Country" type="string">
</cfcomponent>
This component represnts a complex data type that can be used in a component that is exported
as a web service, such as the following:
<cfcomponent>
<cffunction name="echoAddress" returnType="address" access="remote">
<cfargument name="input" type="address">
<cfreturn #arguments.input#>
</cffunction>
</cfcomponent>
required Optional no Whether the parameter is required
yes
no
default Optional If no property value is set when the component is used for a web
service, specifies a default value.
If this attribute is present, the
required attribute must be set to
"
no" or not specified.
displayname Optional A value to be displayed when using introspection to show
information about the CFC. The value appears in parentheses
following the property name.
hint Optional Text to be displayed when using introspection to show
information about the CFC. This attribute can be useful for
describing the purpose of the parameter.
Attribute Req/Opt Default Description