Provides support for writing Java code within ColdFusion.
<cfjava handle="classInstance">
cfjava(handle="classInstance");
Name | Type | Required | Default | Description |
---|---|---|---|---|
handle | variableName | Yes | The variable that holds the value of class instance of the Java code. |
<cfjava handle="nameInstance">
public class Name {
private String firstName;
private String lastName;
public Name(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public String getFullName() {
return firstName + " " + lastName;
}
}
</cfjava>
<cfset nameInstance.init("John", "Doe")>
<cfset fullName = nameInstance.getFullName()>
<cfoutput>#fullName#</cfoutput>