Copy link to clipboard
Copied
Does anybody know how to get (or Cast) a Java Object returned from a Java method call ?
Example:
<cfset someList = object1.method1(someString, JavaCast("float",someNumber),...)>
This method returns a list of Java object of type "Object2". ie. it returns List<Object2>
Now I attempted to loop thru each objects from the returned list, and invoke some method on them, using code similar to below,
<cfset var="#someList[index]#"/>
but ColdFusion does not seem to understand the object "var" as Java "Object2". Is there any way I can cast the "var" to "Object2"?
Thanks in advance.
Xiaoling
Copy link to clipboard
Copied
"var" is a reserved keyword! You can initialize variables with "var" in the beginning of a component, but do not use it as a variables name:
<cfset var someVar = "#someList[index]#">