Product Home Page | Developer Site | Version | |
A Java object returned from a Java method call or field access in a script is automatically wrapped in its own Chili!Beans wrapper. For example, the classes Table and Record are defined as:
//Table.java
package Database ;
public class Table {
public Table(String name, int initialSize) {...};
public int numRecords() {...};
public Record getEmployee(int employeeNumber)
{...};
...
}
//Record.java
package Database ;
public class Record {
public Record() {...};
public String m_LastName ;
public String m_FirstName ;
...
}
The following ASP script will print the names of the employees in Table:
Set t = NewJavaObject("Database/Table", "Employees", 100)
for I = 0 to t.numRecords - 1
set record = t.getEmployee(I)
Response.Write(record.m_FirstName & " " _
& record.m_LastName & "<br>")
next
The Java objects returned by the getEmployee calls on the Table object are automatically given Chili!Beans wrappers, and their methods and fields are available even though they have not been constructed with the CreateObject method.
Copyright © 2003 Sun Microsystems, Inc. All rights reserved.