Code
<cfelseif
Form.employee_grid.rowstatus.action[counter] is
"I">
<cfquery name="InsertNewEmployee"
datasource="CompanyInfo">
INSERT into Employee (LastName, Dept_ID)
VALUES
('#Form.employee_grid.LastName[Counter]#',
#Form.employee_grid.Dept_ID[Counter]#)
</cfquery>
</cfif>
</cfloop>
</cfif>
Embedding Java applets
The
tag lets you embed Java applets either on a ColdFusion page or in a
cfapplet
use
, you must first register your Java applet using the ColdFusion MX Administrator
cfapplet
Java Applets page (under Extensions). In the Administrator, you define the interface to the applet,
encapsulating it so that each invocation of the
The
tag within a form offers several advantages over using the HTML
cfapplet
•
Return values
additional JavaScript to capture the applet's return values. You can reference return values like
any other ColdFusion form variable:
•
Ease of use
tag in your pages only needs to reference the applet name and specify a form variable
cfapplet
name.
•
Parameter defaults
Administrator. You can override these values by specifying parameter value pairs in
When an applet is registered, you enter just the applet source and the form variable name:
<cfapplet appletsource="Calculator"
name="calc_value">
By contrast, with the HTML
you want to use it in a ColdFusion page.
Registering a Java applet
Before you can use a Java applet in your ColdFusion pages, you must register the applet in the
Administrator.
To register a Java applet:
Open the ColdFusion MX Administrator by clicking on the Administrator icon in the
1
ColdFusion Program group and entering the Administrator password.
Under Extensions, click Java Applets.
2
606
Chapter 27: Building Dynamic Forms
Since
requires a form field
cfapplet
Since the applet's interface is defined in the Administrator, each instance of the
ColdFusion uses the parameter value pairs that you defined in the
tag, you must declare all the applet's parameters every time
applet
Description
Otherwise, if the action is to insert a row,
generates a SQL INSERT query to
insert the employee's last name and
department ID from the grid row into the
database. The INSERT assumes that
the DBMS automatically increments the
Emp_ID primary key. If you use the
Dbase version of the CompanyInfo
database that is provided for UNIX
installations, the record is inserted
without an Emp_ID number.
Closes the
among deleting, updating, and inserting.
Closes the loop used for each row to be
changed.
Closes the
active code.
tag is very simple.
cfapplet
name
.
Form.variablename
cfif
tag used to select
tag that surrounds all the
cfif
cfform
applet
attribute, you can avoid coding
. To
tag:
cfapplet.
Need help?
Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?
Questions and answers