On 2008.11.14., at 7:14, Peter Michaux wrote:
How do I create a JavaScript string object in Java?
Context cx = ...;
Scriptable scope = ...;
cx.newObject(scope, "String", new Object[] { "myStringValue" });
You need to have an active scope whose top-level parent can provide
the "String" constructor. Normally, cx.getTopLevelScope() will do,
except if you care about the case we've been discussing vigorously
over the past few days in the "Change Java types for JavaScript
primitives?" list thread and Bugzilla bug 374918 "String primitive
prototype wrongly resolved when used with many top scopes".
Attila.
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino