MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference page 172

Cfml language reference
Hello, I am your AI assistant. How can I help you?
Table of Contents

Advertisement

148
1.
2.
Calling a public method on the object without first calling the "init" method results in
an implicit call to the default constructor. Arguments and return values can be any
valid Java type (simple, arrays, objects). ColdFusion does the appropriate conversions
when strings are passed as arguments, but not when they are received as return values.
Overloaded methods are supported as long as the number of arguments are different.
Future enhancements will let you use cast functions that will allow method signatures
to be built more accurately.
Calling
To create and call all the appropriate EJB objects, use CFOBJECT. The sequence in the
second example assumes that the Weblogic JNDI is used to register and find EJBHome
EJBs
instances.
Example
<!----------------------------------------------------------------------
This CFOBJECT call loads the class MyClass but does not create an
of Java
instance object. Static methods and fields are accessible after a call to
Object
CFOBJECT.
----------------------------------------------------------------------->
<CFOBJECT
ACTION="CREATE"
TYPE="Java"
CLASS="myClass"
NAME="myObj"
>
Example
<!-------------------------------------------------------------
The CFOBJECT tag creates the Weblogic Environment object, which is then
of EJB
used to get the InitialContext. The context object is used to look up the
EJBHome interface. The call to create() results in getting an instance of
stateless session EJB.
----------------------------------------------------------------------->
<CFOBJECT
ACTION="CREATE"
TYPE="JAVA"
CLASS="weblogic/jndi/Environment"
NAME="wlEnv">
<CFSET ctx = wlEnv.getInitialContext()>
<CFSET ejbHome = ctx.lookup("statelessSession.TraderHome")>
<CFSET trader = ejbHome.Create()>
<CFSET value = trader.shareValue(20, 55.45)>
<CFOUTPUT>
Share value = #value#
</CFOUTPUT>
<CFSET value = trader.remove()>
Call CFOBJECT to load the class. See Example.
Use the init method with appropriate arguments to call a constructor
explicitly. For example:
<CFSET ret = myObj.init(arg1, arg2)>
CFML Language Reference

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Coldfusion 4.5

Table of Contents