
Embedding Java Applets
169
Using cfapplet to embed an applet
After you register an applet, you can use the
cfapplet
tag to place the applet in a
ColdFusion page. The
cfapplet
tag has two required attributes:
appletsource
and
name
. Since you registered the applet, and you defined each applet parameter with a
default value, you can invoke the applet with a very simple form of the
cfapplet
tag:
<cfapplet appletSource="
appletname
" name="
form_variable
">
Overriding alignment and positioning values
To override any of the values defined in the Administrator for the applet, you can use
the optional
cfapplet
parameters to specify custom values. For example, the
following
cfapplet
tag specifies custom spacing and alignment values:
<cfapplet appletSource="myapplet"
name="applet1_var"
height=400
width=200
vspace=125
hspace=125
align="left">
Overriding parameter values
You can also override the values that you assigned to applet parameters in the
Administrator by providing new values for any parameter. In order to override a
parameter, you must have already defined the parameter and a default value for it in
the ColdFusion Administrator Applets page.
<cfapplet appletSource="myapplet"
name="applet1_var"
Param1="registered parameter1"
Param2="registered parameter2">
Handling form variables from an applet
The
cfapplet
tag requires you to specify a form variable name for the applet. This
variable, referenced like other ColdFusion form variables,
Form.
variable_name
holds the value the applet method returns when it is executed in the
cfform
.
Not all Java applets return values. For instance, many graphical widgets do not
return a specific value; they do their flipping, spinning, fading, exploding, and that is
all. For this kind of applet, the method field in the Administrator remains empty.
Other applets, however, do have a method that returns a value. You can only use one
method for each applet that you register. If an applet includes more than one
method that you want to access, you can register the applet with a unique name for
each additional method you want to use.
Содержание COLDFUSION 5-DEVELOPING
Страница 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Страница 58: ...38 Chapter 3 Querying a Database ...
Страница 134: ...114 Chapter 7 Updating Your Database ...
Страница 210: ...190 Chapter 10 Reusing Code ...
Страница 232: ...212 Chapter 11 Preventing and Handling Errors ...
Страница 238: ...218 Chapter 12 Using the Application Framework ...
Страница 262: ...242 Chapter 12 Using the Application Framework ...
Страница 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Страница 320: ...300 Chapter 15 Indexing and Searching Data ...
Страница 336: ...316 Chapter 16 Sending and Receiving E mail ...
Страница 374: ...354 Chapter 18 Interacting with Remote Servers ...