Subj : Re: scripting static properties from Host Objects To : mesuti@aciworldwide.com From : Igor Bukanov Date : Fri Feb 27 2004 10:16 am mesuti@aciworldwide.com wrote: > > > > Hi, > > is it possible to use static properties defined in host objects in > JavaScript? You have to setup them manually: define finishInit as described in API docs for ScriptableObject.defineClass and add constants there: static void finishInit(Scriptable scope, FunctionObject constructor, Scriptable prototype) { int attrs = ScriptableObject.READONLY | ScriptableObject.PERMANENT | ScriptableObject.DONTENUM; constructor.defineProperty("EMV", new Integer(1), attrs); constructor.defineProperty("DGI", new Integer(2), attrs); ... } But I would suggest to use direct Java scripting (aka Live Connect) and define a class to serve as source of constants: public class TLV { final public static int EMV = 1; final public static int DGI = 2; final public static int L16 = 3; } .... and then add a class instance to you scope: scope.defineProperty("TLV", new TLV(), attrs); Regards, Igor .