|
Java packages Helma puts the whole wealth of Java libraries at your fingertips. The "Packages" object in Helma's Javascript environment serves as the doorway to leverage any Java packages in the CLASSPATH. You can add any Java packages to the CLASSPATH simply by putting the jar files in the ./lib/ext/ directory. Any public methods that these Java classes define become callable from your application's Javascript environment and you can create and work with Java objects just like you do with Javascript objects. For example, you could create a Java StringBuffer object and then append data to it as follows:
var buffer = new Packages.java.lang.StringBuffer();
buffer.append('hello');
If your application makes extensive use of a Java class, it might be a good idea to wrap that class in a Javascript prototype. That way, the objects your applications works with become true Javascript objects, you can control exactly which class methods are exposed to your application and you can abstract the implementation, allowing you to change the Java classes you use without requiring modifications to your application.Various examples of such wrappers around Java classes can be found in the helmaLib, which makes Mail, File, Ftp, Image, Search, SSH and Zip functionality available in this way. More information on how Helma makes Java scriptable: /docs/reference/java/ /rhino/ScriptingJava
... comment
jdl,
Thursday, 9. March 2006, 19:59
class.properties
This is a good place to mention that Helma supports automatic mapping
of Java objects to HopObjects; see http://helma.org/docs/guide/properties/class.properties/ Also, since it covers the same material, I'd suggest combining this page with http://helma.org/docs/reference/java/ ... link ... comment |
navigation
Download
Community
Weblog
Mailing Lists
IRC Channel
Documentation
Introductions
Tools
Reference
Project
Roadmap
Bug Reporting
Source
Wiki
Tags
Updates
Related Projects
search
|
||||