[daisy] Strangeness with multivalue-fields

Bruno Dumon bruno at outerthought.org
Tue Apr 3 02:00:51 CDT 2007


On Tue, 2007-04-03 at 08:25 +0200, Marc Portier wrote:
> Caleb,
> 
> I haven't tested this myself but I would suspect the mild difference
> between javascript and java arrays to be causing this.
> (So it's an array in javascript land, but when passed to the Java API it
> is seen as one single javascript native object)
> 
> 
> here is how you can create a java string array from within javascript
> 
> var stringClass = java.lang.Class.forName("java.lang.String");
> var vals = java.lang.reflect.Array.newInstance(stringClass, 1);
> vals[0]="X5";

No need for Class.forName, this should also work:

java.lang.reflect.Array.newInstance(java.lang.String, 1);

BTW, the second argument (1) is the size of the array.

See also the Rhino documentation at
http://www.mozilla.org/rhino/doc.html

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno at outerthought.org                          bruno at apache.org



More information about the daisy mailing list