AnsweredAssumed Answered

How to create a Java Map in Javascript

Question asked by iblanco on Oct 28, 2010
Latest reply on Aug 13, 2015 by mdavid.cu
Does anyone know how I can create a Java Map in Javascript, it seems like this should work:


var a = new java.util.HashMap();
a.put("key1", "value1");
a.put("key2", "value2");

But it doesn't work because although the new sentence runs flawlessly "a" is just null.

I see that Alfresco's scripts use always the "ScriptableHashMap" type as a result type for many of their functions, so I tried:


var a = Packages.org.alfresco.repo.jscript.ScriptableHashMap();

But with the same sad result.

Is there any reason why Rhino or Alfresco's Rhino integration doesn't allow the creation of maps ? Something security policyes related or somehting like that ?

Outcomes