Macromedia coldfusion 4.5-cfml language reference ユーザーズマニュアル

ページ / 608
Chapter 1:  ColdFusion Tags
195
The first passes name-value pairs by value. This method uses the attributes NAME and 
VALUE to pass a simple name-value string pair to the servlet. The NAME attribute 
represents the name of the servlet parameter from which the string specified in the 
VALUE attribute can be retrieved. Although the servlet can use these parameters as 
input, it cannot change their values in the ColdFusion template.
The second passes a ColdFusion variable to the servlet by reference. This method uses 
the attribute VARIABLE to pass the specified ColdFusion variable by reference to the 
servlet. Within the servlet, the variable data is made available as servlet attributes in 
the form of Java objects. On the Java side, the data can be manipulated, even changed, 
and those changes will, in turn, change the value of the associated ColdFusion 
variable. 
When used in this mode, the NAME attribute represents the name of the servlet 
attribute that will be created to hold the value of the ColdFusion variable. The 
VARIABLE attribute represents the name, not the #value#, of a ColdFusion variable. 
This ability to directly share ColdFusion variables with a servlet is a powerful extension 
to the servlet API because it allows even complex ColdFusion objects such as 
structures and result sets to be directly accessed from Java. The following table shows 
the mapping between ColdFusion data types (specified with the TYPE attribute) and 
the corresponding Java objects.
Note
You need to have JRun 3.0 in order for the Name/Variable functionality to 
work. You can download the latest version of JRun at the following URL: 
http://www.allaire.com/products/Jrun/
.
In addition, in order to return a modified attribute to ColdFusion, thereby changing 
the value of the ColdFusion variable, you need to call the servlet API setAttribute 
method from the servlet to reset the value of the attribute.
Data Types: CF versus Java
Type 
in Java 
INT
java.lang.Integer
DOUBLE
java.lang.Double
BOOL
java.lang.Bool
DATE
java.util.Date
STRING
java.lang.String
Array
java.util.Vector
Structure
java.util.Hashtable
CF query 
result set
com.allaire.util.RecordSet
(a WDDX-supplied utility class.)