cfdocs

cfcomponent

Creates and defines a component object; encloses functionality that you build in CFML and enclose within cffunction tags. This tag contains one or more cffunction tags that define methods. Code within the body of this tag, other than cffunction tags, is executed when the component is instantiated (like a constructor). Components are saved in a file with a .cfc extension.

Syntax

<cfcomponent>

Script Syntax

component displayname="myComponent" output="false" {  }

Attribute Reference

Name Type Required Default Description Values  
extends string No   Name of parent component from which to inherit methods and properties.    
output boolean No   Specifies whether constructor code in the component can generate HTML output; does not affect output in the body
of cffunction tags in the component.
   
displayname string No   A string to be displayed when using introspection to show information about the CFC. The information appears on the
heading, following the component name.
If the style attribute is set to document, the displayname
attribute is used as the name of the service element in the WSDL.
   
hint string No   Text to be displayed when using introspection to show information about the CFC. The hint attribute value
appears below the component name heading. This attribute
can be useful for describing the purpose of the parameter.
If the style attribute is set to document, the hint
attribute is used as the document element of the service
in the WSDL.
   
style string No rpc CF7+ Specifies whether a CFC used for web services uses RPC-encoded style or document-literal style:
- rpc: RPC-encoded style, default
- document: Document-literal style
If you specify document, you must also specify the namespace,
serviceportname, porttypename, and bindingname attributes.
/Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md document
namespace string No   CF7+ Specifies the namespace used in the WSDL when using the CFC as a document-literal style web service.
If you don’t specify this attribute, ColdFusion MX
derives the namespace from the CFC class name.
This attribute applies only when style=”document”.
   
serviceportname string No   CF7+ Specifies the name of the port element in the WSDL. This attribute applies only when style=”document”.    
porttypename string No   CF7+ Specifies the name of the porttype element in the WSDL. This attribute applies only when style=”document”.    
bindingname string No   CF7+ Specifies the name of the binding element in the WSDL. This attribute applies only when style=”document”.    
wsdlfile string No   CF7+ A properly formatted WSDL file to be used instead of WSDL generated by ColdFusion MX.
This attribute applies only when style=”document”.
   
implements string No   CF8+ Name of the ColdFusion interface or interfaces that this component implements. If the
component implements an interface, it must
define all the functions in the interface, and the
function definitions must conform to the
definitions specified in the interface. For more
information, see cfinterface.
A component can implement any number of
interfaces. To specify multiple interface, use a
comma delimited list, of the format
interface1,interface2.
   
serviceaddress string No   CF8+ Specifies the SOAP URL of the web service.    
initmethod string No   CF9+ Method that will be called when ColdFusion instantiates the component    
persistent boolean No   CF9+ Specifies CFC is persistent or not    
entityname string No   CF9+ Specifies the name of the entity. Entity name is the name used by the ORM related functions to work with the persistent CFC. If entityname is not specified, then the CFC name is taken as the entityname. The entityname must be unique in the application.    
table string No   CF9+ Specifies the name of the database table to which the CFC maps.    
schema string No   CF9+ Used to specify the schema name.    
catalog string No   CF9+ Used to specify the database catalog name.    
dynamicinsert boolean No NO CF9+ Specifies whether INSERT SQL is to be generated at runtime.
Only those columns whose values are not null are included in the SQL.
   
dynamicupdate boolean No NO CF9+ Specifies whether UPDATE SQL is to be generated at runtime.
Only those columns whose values are not null are included in the SQL.
   
readonly boolean No   CF9+ Specify whether table is readonly or not    
selectbeforeupdate boolean No   CF9+ Specify whether Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified.
In cases when a transient object is associated with a new session using update(), Hibernate performs an extra SQL SELECT to determine if an UPDATE is actually required.
   
batchsize numeric No   CF9+ An integer value that specifies the number of records to be retrieved at a single instance.    
optimisticlock string No version CF9+ Determines the locking strategy.
It can be any one of the following four values:
none
version
dirty
all
/Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md version
lazy boolean No YES CF9+ Whether loading is to be done lazily or not.    
rowid string No   CF9+ Row id    
discriminatorColumn string No   CF9+ Use this attribute to define the discriminator column to be used in inheritance mapping    
discriminatorValue string No   CF9+ Use this attribute to define the discriminator value to be used in inheritance mapping    
joinColumn string No   CF9+ Use this attribute to define the join column for inheritance mapping.    
embedded boolean No   CF9+ Marks CFC as embedded, used when a CFC has an embedded object which also needs to be persisted along with the parent’s data    
cacheUse string No   CF9+ Use this value to specify the caching strategy to be used for caching this component’s data in the secondary cache /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md transactional
cacheName string No   CF9+ Use this value to specify the name of the secondary cache.    
saveMapping boolean No NO CF9+ Specifies whether the generated Hibernate mapping file has to be saved to disk. If you set the value to true, the Hibernate mapping XML file is saved with the filename “CFC name”.hbm.xml in the same directory as the CFC.    
accessors boolean No   CF9+ If set to false, ColdFusion ORM does not generate the implicit getters and setters.    
serializable boolean No   CF9+ Specifies whether this component can be serialized. If you set this value to false, the component and the data in the component‚ This and Variables scopes cannot be serialized, so they are not retained on session replication, and the component is in its default state.    
attribute boolean No YES CF9+ If the attribute is set to false at the component level, then the implicit getters and setters for the individual properties are ignored.    
mappedSuperClass boolean No false CF9.0.1+ When true on a non persistent CFC, CFCs that extend this component can inherit properties.    
rest boolean No false CF10+ Enables/disables REST.
restPath must be specified to enable REST
/Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md false
restPath string No   CF10+ Path to access the REST-API /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md false
httpMethod string No   CF10+ /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md OPTIONS
produces string No / CF10+ Comma-separated list of acceptable MIME types for output /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md
consumes string No / CF10+ Comma-separated list of acceptable MIME types for input /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md
indexable boolean No false CF10+ Enables/disables indexing for the component /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md false
indexLanguage string No english CF10+ Set the language to be used to index and search    
autoIndex boolean No true CF10+ Enables/disables auto-indexing /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md false
wsVersion numeric No   CF10+ Set the wsVersion of Axis engine /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md 2
invokeImplicitAccessor boolean No NO CF2016+ Get and set component properties using getter and setter methods defined in the component /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md false

Script Syntax

CF9+

component displayname="Script Widget" output="false" { 
 // functions and properties here 
}

Tag Syntax

<cfcomponent displayname="Tag Widget" output="false"> 
    <!--- functions and other values here ---> 
</cfcomponent>