Using Java Class Objects
ColdFusion allows you to work with nearly any Java class. This means you can use the functionality provided by:
- The built-in classes provided in the Java 2, Standard Edition (J2SE) specification, including the members of such commonly used packages as java.io, java.net, and java.lang.
- The built-in classes provided in the Java 2, Enterprise Edition (J2EE) specification, including the members of javax.ejb, javax.sql, and javax.security.
- Other Java classes that you write yourself or obtain from a third party.
If you have already read Chapter 26, "Extending ColdFusion with COM," or Chapter 28, "Extending ColdFusion with CORBA," you are already familiar with the <cfobject> tag and the CreateObject() function. As you learned in those chapters, a call to <cfobject> or CreateObject() is always the first step when working with COM or CORBA objects. <cfobject> and CreateObject() both do the same thing: return an instance of the desired object. You then work with that instance in your ColdFusion code, generally by calling whatever methods (functions) the object provides.Working with Java objects is not much different. First, you create an instance of the object with <cfobject> or CreateObject(). Then you call the object's methods (or work with its properties). In other words, the mechanics of dealing with any external object in ColdFusion is the same, regardless of whether the object has its roots in COM, CORBA, or Java.Chapter 26).