Monday, 20 January 2014

Object Creation and init() method in ColdFusion

-- In ColdFusion we can create objects in three ways as: cfobject, createObject() and new().
-- The syntax for all three is as below:

1.
<cfobject component=”componentName” name=”objectName”>

2.
<cfscript>
                Variables.objectName = CreateObject(“component”, “componentName”);
</cfscript>

3.
<cfscript>
                Variables.objectName = New componentName(param1, param2,…);
</cfscript>

** Please Note **
The important thing to mention here is the first two methods don’t give call to init() method automatically if not called explicitly, whereas the last one looks for the existence of init() method in the component automatically during object creation and if found then it calls it and returns as per the returnvalue of init() method and if returntype is set to void then the object for the component is returned.

No comments:

Post a Comment

Embedding Power BI Report Using ColdFusion

Recently I got an opportunity to embed power BI reports in ColdFusion Application. Please find the steps and requirements below for implem...