Scripting

Helma provides an interface (namely the Java interface helma.scripting.ScriptingEngine) through which theoretically any Java scripting language can be used for writing application code in Helma. Currently only JavaScript (Rhino) has been implemented for Helma. Other possible candidates for such integration would be Jacl, Jython, JRuby, JudoScript, Pnuts and Groovy.

JavaScript

So, in order to develop Helma applications a thorough knowledge and understanding of the JavaScript language is necessary. The better you learn the language from the beginning on, the smoother your experience with Helma will be.

The Rhino version currently shipped with Helma implements JavaScript 1.5, which confirms to the 3rd edition of the ECMA-262 ECMAScript standard, downloadable from http://www.ecma-international.org/publications/standards/Ecma-262.htm. An extensive, but still readable guide can be found at http://www.croczilla.com/~alex/reference/javascript_guide/index.html, the according reference at http://www.croczilla.com/~alex/reference/javascript_ref/index.html. A much more comprehensive and visually enhanced overview on the syntax is offered at http://javascript-reference.info/. But be aware that often JavaScript references do not just document the language itself, but also the so called host objects common to client-side JavaScript (i.e. 'windows', 'document', etc.). Helma is basically JavaScript 1.5 enhanced with a number of host objects typical for server-side web development. A main part of this documentation is devoted to the description of these additional objects.

Some dummy JavaScript code:

 
// This a comment 
 
/* This is a 
   multi-line 
   comment */ 
 
var m; 
 
var i = 0; 
i = i + 3; 
 
var str = "This is a String."; 
str += " And another one appendend."; 
str += new String(" And another."); 
str = str.substring(str.indexOf("."), str.length - 3); 
 
var bool = true; 
var isTrue = bool ? true : false; 
 
var arr = new Array(); 
arr[0] = "value01"; 
arr.push("value02"); 
var str = arr.join(" & "); 
arr.push([1,2,3,4]); 
var len = arr.length; 
 
var obj = new Object(); 
obj.key01 = "value01"; 
obj["key02"] = str; 
obj.key03 = {name: "product", price: 12.3}; 
obj.key04 = arr; 
 
var date = new Date(); 
var str = date.format("dd.MM.yyyy"); 
 
var j = 0; 
for (var k=0; k<10; k++) { 
   if (k%2 == 0) continue; 
   j += k; 
} 
 
try { 
   someUndefinedFunction(); 
} catch (err) { 
   return "Error occurred!"; 
}