1. user.java
Remember Java is case sensitive unlike ColdFusion.
public class user{
public String getName(){
String name = "joe";
return name;
}
}
2. Drop the user.java file C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\classes directory.
--NOTE I am using localhost mulitserver and this is where I put it.
3. Test.cfm
I create a test.cfm and create an object of user. I can now work with the object.
<cfset user = createObject("java", "user")>
<cfdump var="#user#">
<cfset name = user.getName()/>
<cfdump var="#name#">
No comments:
Post a Comment