Adobe COLDFUSION 9 Manual page 1149

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using Web Elements and External Objects
9
Now you can use the bean methods as required by your application.
When finished, call the
10
close
The following code shows this process using a simple Java Entity bean on a JRun 4.0 server. It calls the
method of the bean to obtain a message.
<html>
<head>
<title>cfobject Test</title>
</head>
<body>
<H1>cfobject Test</H1>
<!--- Create the Context object to get at the static fields. --->
<CFOBJECT
action=create
name=ctx
type="JAVA"
class="javax.naming.Context">
<!--- Create the Properties object and call an explicit constructor--->
<CFOBJECT
action=create
name=prop
type="JAVA"
class="java.util.Properties">
<!--- Call the init method (provided by cfobject)
to invoke the Properties object constructor. --->
<cfset prop.init()>
<!--- Specify the properties These are required for a remote server only --->
<cfset prop.put(ctx.INITIAL_CONTEXT_FACTORY, "jrun.naming.JRunContextFactory")>
<cfset prop.put(ctx.PROVIDER_URL, "localhost:2908")>
<!--- <cfset prop.put(ctx.SECURITY_PRINCIPAL, "admin")>
<cfset prop.put(ctx.SECURITY_CREDENTIALS, "admin")>
--->
<!--- Create the InitialContext --->
<CFOBJECT
action=create
name=initContext
type="JAVA"
class="javax.naming.InitialContext">
<!--- Call the init method (provided through cfobject)
to pass the properties to the InitialContext constructor. --->
<cfset initContext.init(prop)>
method of the context object to close the object.
Last updated 8/5/2010
1144
getMessage

Advertisement

Table of Contents
loading

Table of Contents