CreateObject: Java or EJB object
Description
The
CreateObject
Returns
A Java object.
Function syntax
CreateObject(type, class)
Parameters
Parameter
type
class
Usage
Any Java class available in the class path that is specified in the ColdFusion Administrator can be
loaded and used from ColdFusion with the
To access Java methods and fields:
Call the
1
CreateObject
Use the
2
init
<cfset ret = myObj.init(arg1, arg2)>
Calling a public method on the object without first calling the "init" method invokes a static
method. Arguments and return values can be any Java type (simple, array, object). If strings are
passed as arguments, ColdFusion does the conversions; if strings are received as return values,
ColdFusion does no conversion.
Overloaded methods are supported if the number of arguments is different. Future enhancements
will let you use cast functions that allow method signatures to be built more accurately.
428
Chapter 3: ColdFusion Functions
function can create a Java object, and, by extension, an EJB object.
Description
Type of object to create.
• com
• corba
• java
• component
• webservice
A Java class name
function or the
method, with appropriate arguments, to call an instance of the class. For example:
function.
CreateObject
tag to load the class.
cfobject